Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use_self triggers on code inside macros #9786

Closed
jacobhenn opened this issue Nov 3, 2022 · 3 comments
Closed

use_self triggers on code inside macros #9786

jacobhenn opened this issue Nov 3, 2022 · 3 comments
Labels
C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have

Comments

@jacobhenn
Copy link

Summary

the lint clippy::use_self will emit a false positive on code generated by a macro which triggers it.

Lint Name

use_self

Reproducer

this minimal example:

use derive_more::Display;

#[derive(Display)]
struct Foo;

gives this output:

warning: unnecessary structure name repetition
  --> src/main.rs:8:8
   |
 8 | struct Foo;
   |        ^^^ help: use the applicable keyword: `Self`
   |
   = note: `-W clippy::use-self` implied by `-W clippy::nursery`
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#use_self

Version

rustc 1.65.0 (897e37553 2022-11-02)
binary: rustc
commit-hash: 897e37553bba8b42751c67658967889d11ecd120
commit-date: 2022-11-02
host: x86_64-unknown-linux-gnu
release: 1.65.0
LLVM version: 15.0.0

Additional Labels

No response

@jacobhenn jacobhenn added C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have labels Nov 3, 2022
@kraktus
Copy link
Contributor

kraktus commented Nov 5, 2022

should be fixed by #9454, can you reproduce on nightly?

@jacobhenn
Copy link
Author

yeah, that fixes it. sorry, i tried to search for a pre-existing issue but those didn't come up.

@kraktus
Copy link
Contributor

kraktus commented Nov 7, 2022

No worries thanks for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have
Projects
None yet
Development

No branches or pull requests

2 participants