Skip to content

Commit

Permalink
suppress needless_lifetimes lints from clippy 0.1.83
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-phylum committed Dec 3, 2024
1 parent ad2f20b commit aa19b7c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
4 changes: 2 additions & 2 deletions impl/src/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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)]
Expand Down
15 changes: 15 additions & 0 deletions tests/test_lints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit aa19b7c

Please sign in to comment.