-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
cargo clippy
not obeying [lints.clippy]
from Cargo.toml
, but only for some lints
#11237
Comments
Looks like a cargo issue, it sorts the flags before passing them to clippy but the order matters
|
Closing in favour of rust-lang/cargo#12918 |
As posted here rust-lang/cargo#12918 (comment) The behavior here seems different than rustc. rustc seems to consolidate the lints, apply groups and then the individual settings, whereas Clippy seems to go by the order of the params (and thus the priority). Wouldn't it be better to match rustc's behavior? |
Clippy has no knowledge of the lint table, cargo turns it into |
Add `lint_groups_priority` lint Warns when a lint group in Cargo.toml's `[lints]` section shares the same priority as a lint. This is in the cargo section but is categorised as `correctness` so it's on by default, it doesn't call `cargo metadata` though and parses the `Cargo.toml` directly The lint should be temporary until rust-lang/cargo#12918 is resolved, but in the meanwhile this is an common issue to run into - #11237 - #11751 - #11830 changelog: Add [`lint_groups_priority`] lint r? `@flip1995`
Summary
Clippy does not obey the
lint_name = "allow"
key under[lints.clippy]
fromCargo.toml
for certain lints, but does work as expected for others. The lints have to be silenced with#[allow(...)]
instead.In the example below,
must_use_candidate
obeys the[lints.clippy]
settings, butwildcard_imports
doesn't.Other lints that don't obey
[lints.clippy]
that I have encountered:too_many_lines
option_if_let_else
Reproducer
Cargo.toml
:.cargo/config.toml
:src/lib.rs
:Version
The text was updated successfully, but these errors were encountered: