projects
/
ldk-c-bindings
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d4f7ca4
)
Make `Str`'s `clone` always clone the underlying bytes
author
Matt Corallo
<git@bluematt.me>
Mon, 18 Apr 2022 02:56:05 +0000
(
02:56
+0000)
committer
Matt Corallo
<git@bluematt.me>
Mon, 18 Apr 2022 02:56:05 +0000
(
02:56
+0000)
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`.
lightning-c-bindings/src/c_types/mod.rs
patch
|
blob
|
history
diff --git
a/lightning-c-bindings/src/c_types/mod.rs
b/lightning-c-bindings/src/c_types/mod.rs
index 1e88f0521e53c8ce56372278b3dcb17d3e4db3e5..12c70888b20585ef73b9872dbbb892251af09795 100644
(file)
--- a/
lightning-c-bindings/src/c_types/mod.rs
+++ b/
lightning-c-bindings/src/c_types/mod.rs
@@
-569,7
+569,7
@@
impl Into<Str> for String {
}
impl Clone for Str {
fn clone(&self) -> Self {
}
impl Clone for Str {
fn clone(&self) -> Self {
-
self.into_str().clone(
).into()
+
String::from(self.into_str()
).into()
}
}
}
}