-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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-macrosType: Issues with macros and macro expansionType: Issues with macros and macro expansiongood first issueThese issues are a good way to get started with ClippyThese issues are a good way to get started with Clippy
Description
It looks like use_self
is triggered inside derived macro-generated code. While derived macro authors may handle that on their part, it is still not feasible to expect that to happen overnight. Right now everyone wishing to use this lint inside their own code is affected.
Lint name: use_self
I tried this code:
#![deny(clippy::use_self)]
use serde::{Serialize, Deserialize};
#[derive(Clone, Debug, Default, Serialize, Deserialize)]
struct Text {
text: String,
}
fn main() {
let text = Text { text: String::from("bar") };
println!("{:?}", text);
}
I expected to see this happen: clean cargo clippy run
Instead, this happened:
Checking playground v0.0.1 (/playground)
error: unnecessary structure name repetition
--> src/main.rs:6:8
|
6 | struct Text {
| ^^^^ help: use the applicable keyword: `Self`
|
note: the lint level is defined here
--> src/main.rs:1:9
|
1 | #![deny(clippy::use_self)]
| ^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self
error: aborting due to previous error
error: could not compile `playground`
To learn more, run the command again with --verbose.
Meta
cargo clippy -V
: clippy 0.1.52 (e37a13c 2021-02-28)rustc -Vv
:
rustc 1.52.0-nightly (e37a13c 2021-02-28)
binary: rustc
commit-hash: e37a13c
commit-date: 2021-02-28
host: x86_64-unknown-linux-gnu
release: 1.52.0-nightly
LLVM version: 11.0.1
ChrisJefferson, saruman9 and TheAlgorythm
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-macrosType: Issues with macros and macro expansionType: Issues with macros and macro expansiongood first issueThese issues are a good way to get started with ClippyThese issues are a good way to get started with Clippy