Extend extra_unused_lifetimes to handle impl lifetimes
This commit is contained in:
parent
ed22428b72
commit
b35c04f7dc
7 changed files with 97 additions and 12 deletions
|
|
@ -1,4 +1,4 @@
|
|||
#[allow(dead_code)]
|
||||
#![allow(dead_code, clippy::extra_unused_lifetimes)]
|
||||
|
||||
/// Test for https://github.com/rust-lang/rust-clippy/issues/2865
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/// Test for https://github.com/rust-lang/rust-clippy/issues/2865
|
||||
/// Test for https://github.com/rust-lang/rust-clippy/issues/3151
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct HashMap<V, S> {
|
||||
|
|
|
|||
|
|
@ -72,4 +72,20 @@ mod issue4291 {
|
|||
}
|
||||
}
|
||||
|
||||
mod issue6437 {
|
||||
pub struct Scalar;
|
||||
|
||||
impl<'a> std::ops::AddAssign<&Scalar> for &mut Scalar {
|
||||
fn add_assign(&mut self, _rhs: &Scalar) {
|
||||
unimplemented!();
|
||||
}
|
||||
}
|
||||
|
||||
impl<'b> Scalar {
|
||||
pub fn something<'c>() -> Self {
|
||||
Self
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -24,5 +24,23 @@ error: this lifetime isn't used in the function definition
|
|||
LL | fn unused_lt<'a>(x: u8) {}
|
||||
| ^^
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
error: this lifetime isn't used in the impl
|
||||
--> $DIR/extra_unused_lifetimes.rs:78:10
|
||||
|
|
||||
LL | impl<'a> std::ops::AddAssign<&Scalar> for &mut Scalar {
|
||||
| ^^
|
||||
|
||||
error: this lifetime isn't used in the impl
|
||||
--> $DIR/extra_unused_lifetimes.rs:84:10
|
||||
|
|
||||
LL | impl<'b> Scalar {
|
||||
| ^^
|
||||
|
||||
error: this lifetime isn't used in the function definition
|
||||
--> $DIR/extra_unused_lifetimes.rs:85:26
|
||||
|
|
||||
LL | pub fn something<'c>() -> Self {
|
||||
| ^^
|
||||
|
||||
error: aborting due to 7 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#![allow(dead_code)]
|
||||
#![allow(dead_code, clippy::extra_unused_lifetimes)]
|
||||
#![warn(clippy::multiple_inherent_impl)]
|
||||
|
||||
struct MyStruct;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#![allow(dead_code, clippy::missing_safety_doc)]
|
||||
#![allow(dead_code, clippy::missing_safety_doc, clippy::extra_unused_lifetimes)]
|
||||
#![warn(clippy::new_without_default)]
|
||||
|
||||
pub struct Foo;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue