From 62441dfba18a91fd52a28a943bb2d457765582bc Mon Sep 17 00:00:00 2001 From: Kitlith Date: Tue, 12 Sep 2023 16:46:49 -0700 Subject: [PATCH] Use struct update syntax for ItemStruct Co-authored-by: pickx --- bilge-impl/src/bitsize.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bilge-impl/src/bitsize.rs b/bilge-impl/src/bitsize.rs index 9f218e0..db214ee 100644 --- a/bilge-impl/src/bitsize.rs +++ b/bilge-impl/src/bitsize.rs @@ -129,9 +129,10 @@ fn generate_struct(item: &ItemStruct, declared_bitsize: u8) -> TokenStream { quote!(#acc + #field_size) }); - // The only part of the struct we don't want to pass through are the attributes - let mut item = item.clone(); - item.attrs = Vec::new(); + let item = ItemStruct { + attrs: Vec::new(), + ..item.clone() + }; let (impl_generics, ty_generics, where_clause) = generics.split_for_impl();