rust-lang / rust-clippy

A bunch of lints to catch common mistakes and improve your Rust code. Book: https://doc.rust-lang.org/clippy/
https://rust-lang.github.io/rust-clippy/
Other
10.89k stars 1.46k forks source link

`lint_groups_priority` does not work for workspace `Cargo.toml` #12729

Open Kriskras99 opened 2 weeks ago

Kriskras99 commented 2 weeks ago

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