Skip to content

Commit 4fde284

Browse files
authored
Merge pull request #391 from matt-phylum/needless-lifetimes
suppress needless_lifetimes lints from clippy 0.1.83
2 parents ad2f20b + aa19b7c commit 4fde284

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

impl/src/expand.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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)]

tests/test_lints.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff 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+
}

0 commit comments

Comments
 (0)