File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -197,7 +197,7 @@ fn impl_struct(input: Struct) -> TokenStream {
197197 let source_var = Ident :: new ( "source" , span) ;
198198 let body = from_initializer ( from_field, backtrace_field, & source_var) ;
199199 quote_spanned ! { span=>
200- #[ allow( unused_qualifications) ]
200+ #[ allow( unused_qualifications, clippy :: needless_lifetimes ) ]
201201 #[ automatically_derived]
202202 impl #impl_generics :: core:: convert:: From <#from> for #ty #ty_generics #where_clause {
203203 #[ allow( deprecated) ]
@@ -462,7 +462,7 @@ fn impl_enum(input: Enum) -> TokenStream {
462462 let source_var = Ident :: new ( "source" , span) ;
463463 let body = from_initializer ( from_field, backtrace_field, & source_var) ;
464464 Some ( quote_spanned ! { span=>
465- #[ allow( unused_qualifications) ]
465+ #[ allow( unused_qualifications, clippy :: needless_lifetimes ) ]
466466 #[ automatically_derived]
467467 impl #impl_generics :: core:: convert:: From <#from> for #ty #ty_generics #where_clause {
468468 #[ allow( deprecated) ]
Original file line number Diff line number Diff line change @@ -18,3 +18,18 @@ fn test_unused_qualifications() {
1818
1919 let _: MyError ;
2020}
21+
22+ #[ test]
23+ fn test_needless_lifetimes ( ) {
24+ #![ allow( dead_code) ]
25+ #![ deny( clippy:: needless_lifetimes) ]
26+
27+ #[ derive( Debug , Error ) ]
28+ #[ error( "..." ) ]
29+ pub enum MyError < ' a > {
30+ A ( #[ from] std:: io:: Error ) ,
31+ B ( & ' a ( ) ) ,
32+ }
33+
34+ let _: MyError ;
35+ }
You can’t perform that action at this time.
0 commit comments