Skip to content

Commit 8f3b8e4

Browse files
committed
Make Str's clone always clone the underlying bytes
Its incredibly unexpected that you can clone a higher-level object (eg an Event with a ClosureReason that contains an `Str`) and have a pointer back to the original object. To avoid this, `clone` needs to actually `clone`.
1 parent d4f7ca4 commit 8f3b8e4

File tree

1 file changed

+1
-1
lines changed
  • lightning-c-bindings/src/c_types

1 file changed

+1
-1
lines changed

lightning-c-bindings/src/c_types/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ impl Into<Str> for String {
569569
}
570570
impl Clone for Str {
571571
fn clone(&self) -> Self {
572-
self.into_str().clone().into()
572+
String::from(self.into_str()).into()
573573
}
574574
}
575575

0 commit comments

Comments
 (0)