]> git.bitcoin.ninja Git - ldk-c-bindings/commitdiff
Use `Clone::clone(a)` rather than `a.clone` to avoid deref recursion
authorMatt Corallo <git@bluematt.me>
Sat, 24 Dec 2022 22:57:17 +0000 (22:57 +0000)
committerMatt Corallo <git@bluematt.me>
Sat, 24 Dec 2022 22:59:55 +0000 (22:59 +0000)
c-bindings-gen/src/main.rs

index 02aa72fdc46c2c36241f270b3e9b547df47ee49b..0e9a42286a1434ef6a8e3ea4f8c60356277c658e 100644 (file)
@@ -1779,7 +1779,7 @@ fn writeln_enum<'a, 'b, W: std::io::Write>(w: &mut W, e: &'a syn::ItemEnum, type
                                                };
                                                if $ref || new_var {
                                                        if $ref {
-                                                               write!(w, "let mut {}_nonref = (*{}).clone();\n\t\t\t\t", $field_ident, $field_ident).unwrap();
+                                                               write!(w, "let mut {}_nonref = Clone::clone({});\n\t\t\t\t", $field_ident, $field_ident).unwrap();
                                                                if new_var {
                                                                        let nonref_ident = format_ident!("{}_nonref", $field_ident);
                                                                        if $to_c {