diff --git a/impl/src/ast.rs b/impl/src/ast.rs index 9e069289..4739d58b 100644 --- a/impl/src/ast.rs +++ b/impl/src/ast.rs @@ -82,7 +82,7 @@ impl<'a> Enum<'a> { .map(|node| { let mut variant = Variant::from_syn(node, &scope, span)?; if let display @ None = &mut variant.attrs.display { - *display = attrs.display.clone(); + display.clone_from(&attrs.display); } if let Some(display) = &mut variant.attrs.display { display.expand_shorthand(&variant.fields); diff --git a/impl/src/expand.rs b/impl/src/expand.rs index 1b44513a..296b567b 100644 --- a/impl/src/expand.rs +++ b/impl/src/expand.rs @@ -155,7 +155,7 @@ fn impl_struct(input: Struct) -> TokenStream { ::core::fmt::Display::fmt(&self.#only_field, __formatter) }) } else if let Some(display) = &input.attrs.display { - display_implied_bounds = display.implied_bounds.clone(); + display_implied_bounds.clone_from(&display.implied_bounds); let use_as_display = use_as_display(display.has_bonus_display); let pat = fields_pat(&input.fields); Some(quote! { @@ -399,7 +399,7 @@ fn impl_enum(input: Enum) -> TokenStream { let mut display_implied_bounds = Set::new(); let display = match &variant.attrs.display { Some(display) => { - display_implied_bounds = display.implied_bounds.clone(); + display_implied_bounds.clone_from(&display.implied_bounds); display.to_token_stream() } None => {