Skip to content

use_self triggers on code inside macros #9786

Closed
@jacobhenn

Description

@jacobhenn

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't have

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions