-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Override clippy::pedantic
in Cargo.toml
#11830
Comments
You should be able to override pedantic either by giving that a lower priority (eg. -1) or set a higher priority for individual lints, eg. |
Rust itself works fine with this one:
Seems like rust itself has a ruleset that individual lint settings stump the group's setting. Can't we adopt this in Clippy? That way we don't have to deal with the priority for simpler cases. |
I think a better interim solution is to always use |
@kristof-mattei If I try this with a different group, then this also fails for rustc much in the same way: [lints.rust]
unused = "deny"
unused_variables = "allow"
If I understand the RFC correctly, the order in which lint cap args are passed to rustc within the same group are unspecified and cargo might just happen to sort them in reverse lexicographic order right now (unused_variables > unused) |
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`
Description
I'm testing the new
[lints]
functionality inCargo.toml
, which I'm very excited to have on stable!I've just tried the following
Cargo.toml
configuration:The idea is that I want to lint against the whole pedantic category but then whitelist specific lints from that category which I'm ok with not complying with.
However, this doesn't work, the
simliar_names
lint is still reported:I believe this is because the order which
Cargo
has passed the flags to clippy on the command line has placed the allow lints before the warn.One fix I can imagine is that clippy should prioritize individual lint flags over their category flags, ignoring the command line order for this case, but this is probably a (minor) breaking change, so there would need to be discussion on whether it's valid to do so.
Version
Additional Labels
@rustbot-label +C-enhancement
The text was updated successfully, but these errors were encountered: