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 lint triggers on #[derive(Deserialize)] #6894

Closed
rossmacarthur opened this issue Mar 13, 2021 · 2 comments
Closed

use_self lint triggers on #[derive(Deserialize)] #6894

rossmacarthur opened this issue Mar 13, 2021 · 2 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

@rossmacarthur
Copy link

rossmacarthur commented Mar 13, 2021

Lint name: use_self

I tried this code:

// lib.rs
use serde::Deserialize;

#[derive(Deserialize)]
struct Settings {}

And ran

cargo +nightly clippy -- -D clippy::use-self

I expected to see this happen: no error

Instead, this happened: use_self lint triggers

error: unnecessary structure name repetition
 --> src/lib.rs:4:8
  |
4 | struct Settings {}
  |        ^^^^^^^^ help: use the applicable keyword: `Self`
  |
  = note: requested on the command line with `-D 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 `clippy-test`

To learn more, run the command again with --verbose.

Meta

  • cargo +nightly clippy -V:
    clippy 0.1.52 (b3e19a22 2021-03-12)
    
  • rustc +nightly -Vv:
    rustc 1.52.0-nightly (b3e19a221 2021-03-12)
    binary: rustc
    commit-hash: b3e19a221e63dcffdef87e12eadf1f36a8b90295
    commit-date: 2021-03-12
    host: x86_64-apple-darwin
    release: 1.52.0-nightly
    LLVM version: 12.0.0
    
@rossmacarthur rossmacarthur 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 Mar 13, 2021
@Y-Nak
Copy link
Contributor

Y-Nak commented Mar 13, 2021

This seems a duplicate of #6818.

@rossmacarthur
Copy link
Author

You're right

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