@@ -169,15 +169,18 @@ fn impl_struct(input: Struct) -> TokenStream {
169
169
let from = unoptional_type ( from_field. ty ) ;
170
170
let source_var = Ident :: new ( "source" , span) ;
171
171
let body = from_initializer ( from_field, backtrace_field, & source_var) ;
172
- quote_spanned ! { span=>
173
- #[ allow( deprecated, unused_qualifications, clippy:: needless_lifetimes) ]
172
+ let impl_impl = quote_spanned ! { span=>
174
173
#[ automatically_derived]
175
174
impl #impl_generics :: core:: convert:: From <#from> for #ty #ty_generics #where_clause {
176
175
fn from( #source_var: #from) -> Self {
177
176
#ty #body
178
177
}
179
178
}
180
- }
179
+ } ;
180
+ Some ( quote ! {
181
+ #[ allow( deprecated, unused_qualifications, clippy:: needless_lifetimes) ]
182
+ #impl_impl
183
+ } )
181
184
} ) ;
182
185
183
186
if input. generics . type_params ( ) . next ( ) . is_some ( ) {
@@ -433,14 +436,17 @@ fn impl_enum(input: Enum) -> TokenStream {
433
436
let from = unoptional_type ( from_field. ty ) ;
434
437
let source_var = Ident :: new ( "source" , span) ;
435
438
let body = from_initializer ( from_field, backtrace_field, & source_var) ;
436
- Some ( quote_spanned ! { span=>
437
- #[ allow( deprecated, unused_qualifications, clippy:: needless_lifetimes) ]
439
+ let impl_impl = quote_spanned ! { span=>
438
440
#[ automatically_derived]
439
441
impl #impl_generics :: core:: convert:: From <#from> for #ty #ty_generics #where_clause {
440
442
fn from( #source_var: #from) -> Self {
441
443
#ty:: #variant #body
442
444
}
443
445
}
446
+ } ;
447
+ Some ( quote ! {
448
+ #[ allow( deprecated, unused_qualifications, clippy:: needless_lifetimes) ]
449
+ #impl_impl
444
450
} )
445
451
} ) ;
446
452
0 commit comments