@@ -169,15 +169,18 @@ fn impl_struct(input: Struct) -> TokenStream {
169169 let from = unoptional_type ( from_field. ty ) ;
170170 let source_var = Ident :: new ( "source" , span) ;
171171 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=>
174173 #[ automatically_derived]
175174 impl #impl_generics :: core:: convert:: From <#from> for #ty #ty_generics #where_clause {
176175 fn from( #source_var: #from) -> Self {
177176 #ty #body
178177 }
179178 }
180- }
179+ } ;
180+ Some ( quote ! {
181+ #[ allow( deprecated, unused_qualifications, clippy:: needless_lifetimes) ]
182+ #impl_impl
183+ } )
181184 } ) ;
182185
183186 if input. generics . type_params ( ) . next ( ) . is_some ( ) {
@@ -433,14 +436,17 @@ fn impl_enum(input: Enum) -> TokenStream {
433436 let from = unoptional_type ( from_field. ty ) ;
434437 let source_var = Ident :: new ( "source" , span) ;
435438 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=>
438440 #[ automatically_derived]
439441 impl #impl_generics :: core:: convert:: From <#from> for #ty #ty_generics #where_clause {
440442 fn from( #source_var: #from) -> Self {
441443 #ty:: #variant #body
442444 }
443445 }
446+ } ;
447+ Some ( quote ! {
448+ #[ allow( deprecated, unused_qualifications, clippy:: needless_lifetimes) ]
449+ #impl_impl
444450 } )
445451 } ) ;
446452
0 commit comments