diff --git a/impl/src/expand.rs b/impl/src/expand.rs index e172af9..23e77b6 100644 --- a/impl/src/expand.rs +++ b/impl/src/expand.rs @@ -197,7 +197,7 @@ fn impl_struct(input: Struct) -> TokenStream { let source_var = Ident::new("source", span); let body = from_initializer(from_field, backtrace_field, &source_var); quote_spanned! {span=> - #[allow(unused_qualifications)] + #[allow(unused_qualifications, clippy::needless_lifetimes)] #[automatically_derived] impl #impl_generics ::core::convert::From<#from> for #ty #ty_generics #where_clause { #[allow(deprecated)] @@ -462,7 +462,7 @@ fn impl_enum(input: Enum) -> TokenStream { let source_var = Ident::new("source", span); let body = from_initializer(from_field, backtrace_field, &source_var); Some(quote_spanned! {span=> - #[allow(unused_qualifications)] + #[allow(unused_qualifications, clippy::needless_lifetimes)] #[automatically_derived] impl #impl_generics ::core::convert::From<#from> for #ty #ty_generics #where_clause { #[allow(deprecated)] diff --git a/tests/test_lints.rs b/tests/test_lints.rs index cafcbc0..1473682 100644 --- a/tests/test_lints.rs +++ b/tests/test_lints.rs @@ -18,3 +18,18 @@ fn test_unused_qualifications() { let _: MyError; } + +#[test] +fn test_needless_lifetimes() { + #![allow(dead_code)] + #![deny(clippy::needless_lifetimes)] + + #[derive(Debug, Error)] + #[error("...")] + pub enum MyError<'a> { + A(#[from] std::io::Error), + B(&'a ()), + } + + let _: MyError; +}