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

readme suggests nonexisting lint #3210

Closed
matthiaskrgr opened this issue Sep 22, 2018 · 6 comments
Closed

readme suggests nonexisting lint #3210

matthiaskrgr opened this issue Sep 22, 2018 · 6 comments

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Sep 22, 2018

clippy 0.0.212 (125907a 2018-09-17)

The readme states
"
For this to work you have to use Clippy on the nightly toolchain: cargo +nightly clippy. If you
want to use Clippy with the stable toolchain, you can stick to the old unscoped method to
enable/disable Clippy lints until tool_lints are stable:

#![cfg_attr(feature = "cargo-clippy", allow(clippy_lint))]

"
However there is no clippy_lintlint that could be suppressed/allowed.

warning: unknown lint: `clippy_lint`
  --> src/lib.rs:16:45
   |
16 | #![cfg_attr(feature = "cargo-clippy", allow(clippy_lint))]
   |                                             ^^^^^^^^^^^
   |
   = note: #[warn(unknown_lints)] on by default

EDIT: repro sample:

#![cfg_attr(feature = "cargo-clippy", allow(clippy_lint))]
#![cfg_attr(feature = "cargo-clippy", warn(if_not_else))]
fn main() {
    println!("Hello, world!");
}

cc @flip1995

@flip1995
Copy link
Member

Oh yeah clippy_lint does not exist, I just used it as a placeholder. Maybe I should have made this more obvious.

@matthiaskrgr
Copy link
Member Author

Ah, so there actually is no way to work around this besides
#![cfg_attr(feature = "cargo-clippy", allow(renamed_and_removed_lints))] ?

@flip1995
Copy link
Member

If you use Clippy on the stable or beta toolchain (cargo +stable clippy/cargo +beta clippy) the tool_lints warning won't be emitted (rust-lang/rust#54358) until they are stable. If you use Clippy on the nightly toolchain (cargo +nightly clippy), you should move to tool_lints with the

#![cfg_attr(feature = "cargo-clippy", feature(tool_lints)]

workaround.

The only time #![cfg_attr(feature = "cargo-clippy", allow(renamed_and_removed_lints))] should be used IMO is when you use clippy on both nightly and stable/beta toolchain. But I don't see why someone would want to do that.

@matthiaskrgr
Copy link
Member Author

Hmm, I would like to have the crate still compile on stable/beta, silence the warnings about deprecated cfg_attr on all releases that have the tool_lints feature but also still get warnings about typoed lint names, thus allow(renamed_and_removed_lints) is not really what I want :/

@flip1995
Copy link
Member

Yeah just allow(renamed_and_removed_lints) really shouldn't be used. Than the cfg_attr variant might be good. We should stabilize the tool_lints. I try to do this until 1.31 stable.

@phansch
Copy link
Member

phansch commented Dec 11, 2018

tool_lints are stable now, so closing 🔒

@phansch phansch closed this as completed Dec 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants