-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't haveT-const-genericsType: Issues related to const genericsType: Issues related to const generics
Description
Lint name: use_self
Reproduction using current nightly on Playground
I tried this code:
#![warn(clippy::use_self)]
struct MyStruct<const C: char>;
impl From<MyStruct<'a'>> for MyStruct<'b'> {
fn from(_s: MyStruct<'a'>) -> Self {
Self
}
}
fn main() {}
I expected to see this happen: No clippy warnings.
Instead, this happened:
Checking playground v0.0.1 (/playground)
warning: unnecessary structure name repetition
--> src/main.rs:5:11
|
5 | impl From<MyStruct<'a'>> for MyStruct<'b'> {
| ^^^^^^^^^^^^^ help: use the applicable keyword: `Self`
|
note: the lint level is defined here
--> src/main.rs:1:9
|
1 | #![warn(clippy::use_self)]
| ^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
warning: unnecessary structure name repetition
--> src/main.rs:6:17
|
6 | fn from(_s: MyStruct<'a'>) -> Self {
| ^^^^^^^^^^^^^ help: use the applicable keyword: `Self`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
warning: 2 warnings emitted
Finished dev [unoptimized + debuginfo] target(s) in 0.88s
Using Self
in either of the spots indicated changes the meaning of the code.
Meta
Clippy and rustc are current nightly: 2021-05-09
This seems like a very similar error to #7205, but I filed them separately because they're different lints.
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't haveT-const-genericsType: Issues related to const genericsType: Issues related to const generics