Skip to content

lint_groups_priority clippy lint seems to misattribute lints to groups #12920

Open
@palant

Description

@palant

I’m using the following Cargo.toml:

[package]
name = "testing"
version = "0.1.0"
edition = "2021"

[lints.clippy]
lint_groups_priority = "warn"

[lints.rust]
keyword_idents = "deny"
macro_use_extern_crate = "deny"
rust_2018_idioms = "deny"
single_use_lifetimes = "deny"

Running cargo clippy produces two warnings here:

warning: lint group `keyword_idents` has the same priority (0) as a lint
  --> Cargo.toml:10:1
   |
10 | keyword_idents = "deny"
   | ^^^^^^^^^^^^^^   ------ has an implicit priority of 0
11 | macro_use_extern_crate = "deny"
   | ---------------------- 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: requested on the command line with `-W clippy::lint-groups-priority`
help: to have lints override the group set `keyword_idents` to a lower priority
   |
10 | keyword_idents = { level = "deny", priority = -1 }
   |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

warning: lint group `rust_2018_idioms` has the same priority (0) as a lint
  --> Cargo.toml:12:1
   |
12 | rust_2018_idioms = "deny"
   | ^^^^^^^^^^^^^^^^   ------ has an implicit priority of 0
13 | single_use_lifetimes = "deny"
   | -------------------- 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
help: to have lints override the group set `rust_2018_idioms` to a lower priority
   |
12 | rust_2018_idioms = { level = "deny", priority = -1 }
   |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

While making the proposed changes silences the warnings, these look like false positives. According to documentation, single_use_lifetimes isn’t part of rust_2018_idioms, and keyword_idents isn’t a group at all.

Meta

rustc --version --verbose:

rustc 1.81.0-nightly (d0227c6a1 2024-06-11)
binary: rustc
commit-hash: d0227c6a19c2d6e8dceb87c7a2776dc2b10d2a04
commit-date: 2024-06-11
host: x86_64-unknown-linux-gnu
release: 1.81.0-nightly
LLVM version: 18.1.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingD-confusingI-false-positiveIssue: The lint was triggered on code it shouldn't have

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions