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

lint_groups_priority does not work for workspace Cargo.toml #12729

Open
Kriskras99 opened this issue Apr 28, 2024 · 0 comments
Open

lint_groups_priority does not work for workspace Cargo.toml #12729

Kriskras99 opened this issue Apr 28, 2024 · 0 comments
Labels
C-bug Category: Clippy is not doing the correct thing I-false-negative Issue: The lint should have been triggered on code, but wasn't

Comments

@Kriskras99
Copy link

Summary

If you set your lints in the workspace Cargo.toml, the lint_groups_priority lint does not work.

Lint Name

lint_groups_priority

Reproducer

I tried this code:

[workspace.lints.clippy]
cargo = "warn"
multiple_crate_versions = "allow"

I expected to see this happen:

error: lint group `cargo` has the same priority (0) as a lint
  --> Cargo.toml:16:1
   |
16 | cargo = "warn"
   | ^^^^^   ------ has an implicit priority of 0
17 | multiple_crate_versions = "allow"
   | ----------------------- has the same priority as this lint
   |
   = note: the order of the lints in the table is ignored by Cargo
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#lint_groups_priority
   = note: `#[deny(clippy::lint_groups_priority)]` on by default
help: to have lints override the group set `cargo` to a lower priority
   |
16 | cargo = { level = "warn", priority = -1 }
   |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Instead, this happened:
Nothing

Version

rustc 1.79.0-nightly (ef8b9dcf2 2024-04-24)
binary: rustc
commit-hash: ef8b9dcf23700f2e2265317611460d3a65c19eff
commit-date: 2024-04-24
host: x86_64-unknown-linux-gnu
release: 1.79.0-nightly
LLVM version: 18.1.4
@Kriskras99 Kriskras99 added C-bug Category: Clippy is not doing the correct thing I-false-negative Issue: The lint should have been triggered on code, but wasn't labels Apr 28, 2024
bors added a commit that referenced this issue May 12, 2024
…rednet

Lint direct priority conflicts in `[workspace.lints]`

Partially addresses #12729

This still doesn't do any workspace resolution stuff, so it will not catch any virtual workspaces or conflicts from inherited definitions. But while we're parsing the `Cargo.toml` we might as well check the workspace definitions if we find them

changelog: none
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-negative Issue: The lint should have been triggered on code, but wasn't
Projects
None yet
Development

No branches or pull requests

1 participant