Merge pull request #391 from matt-phylum/needless-lifetimes

suppress needless_lifetimes lints from clippy 0.1.83
This commit is contained in:
David Tolnay 2024-12-03 07:05:54 -08:00 committed by GitHub
commit 4fde2846c8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 2 deletions

View file

@ -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)]

View file

@ -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;
}