From 2266152b163168df75a3b091208b86dd05485e66 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Fri, 7 Aug 2026 23:20:11 -0700 Subject: [PATCH] Suppress redundant_field_names clippy lint warning: redundant field names in struct initialization --> tests/test_from.rs:9:5 | 9 | / #[from] 10 | | source: io::Error, | |__________^ help: replace it with: `source` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names = note: `-W clippy::redundant-field-names` implied by `-W clippy::all` = help: to override `-W clippy::all` add `#[allow(clippy::redundant_field_names)]` warning: redundant field names in struct initialization --> tests/test_from.rs:32:9 | 32 | / #[from] 33 | | source: io::Error, | |______________^ help: replace it with: `source` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names warning: redundant field names in struct initialization --> tests/test_generics.rs:145:5 | 145 | / #[from] 146 | | pub source: StructDebugGeneric, | |______________^ help: replace it with: `source` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names = note: `-W clippy::redundant-field-names` implied by `-W clippy::all` = help: to override `-W clippy::all` add `#[allow(clippy::redundant_field_names)]` --- impl/src/expand.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/impl/src/expand.rs b/impl/src/expand.rs index 4e11ff8a..e3ac7793 100644 --- a/impl/src/expand.rs +++ b/impl/src/expand.rs @@ -171,6 +171,7 @@ fn impl_struct(input: Struct) -> TokenStream { let source_var = Ident::new("source", span); let body = from_initializer(from_field, backtrace_field, &source_var); let from_function = quote! { + #[allow(clippy::redundant_field_names)] fn from(#source_var: #from) -> Self { #ty #body } @@ -453,6 +454,7 @@ fn impl_enum(input: Enum) -> TokenStream { let source_var = Ident::new("source", span); let body = from_initializer(from_field, backtrace_field, &source_var); let from_function = quote! { + #[allow(clippy::redundant_field_names)] fn from(#source_var: #from) -> Self { #ty::#variant #body }