From 077c4d770eaa919ed9f4aef56375abe9ef50e55a Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Sat, 24 Dec 2022 22:57:17 +0000 Subject: [PATCH] Use `Clone::clone(a)` rather than `a.clone` to avoid deref recursion --- c-bindings-gen/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c-bindings-gen/src/main.rs b/c-bindings-gen/src/main.rs index 02aa72f..0e9a422 100644 --- a/c-bindings-gen/src/main.rs +++ b/c-bindings-gen/src/main.rs @@ -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 { -- 2.39.5