From bd07a4d6ffdfcf6b8dd8c5b73f6bb43378a05a9f Mon Sep 17 00:00:00 2001 From: Jelte Fennema-Nio Date: Wed, 3 Jul 2024 16:10:00 +0200 Subject: [PATCH] Don't use double ref vars in Debug derive --- impl/src/fmt/debug.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/impl/src/fmt/debug.rs b/impl/src/fmt/debug.rs index 68e873e1..9b4e99ff 100644 --- a/impl/src/fmt/debug.rs +++ b/impl/src/fmt/debug.rs @@ -82,7 +82,7 @@ fn expand_struct( .ident .clone() .map_or_else(|| syn::Member::Unnamed(i.into()), syn::Member::Named); - quote! { let #var = &&self.#member; } + quote! { let #var = &self.#member; } }); let body = quote! { @@ -275,7 +275,7 @@ impl<'a> Expansion<'a> { None => { let ident = format_ident!("_{i}"); Ok(quote! { - derive_more::__private::DebugTuple::field(#out, #ident) + derive_more::__private::DebugTuple::field(#out, &#ident) }) } }, @@ -316,7 +316,7 @@ impl<'a> Expansion<'a> { ) }), None => Ok(quote! { - derive_more::core::fmt::DebugStruct::field(#out, #field_str, #field_ident) + derive_more::core::fmt::DebugStruct::field(#out, #field_str, &#field_ident) }), } })?;