Skip to content

lint_groups_priority is raised for rust_2018_idioms = "deny", warnings = "deny" #12270

Closed
@Arnavion

Description

@Arnavion

Summary

If I understand correctly, this is a false positive for two different reasons:

  1. If a lint and a lint group have the same priority but also have the same level, then the order doesn't matter, so the lint need not fire.

  2. If the lint involved is warnings, then the order doesn't matter, so the lint need not fire.

Lint Name

lint_groups_priority

Reproducer

I tried this code:

[lints.rust]
rust_2018_idioms = "deny"
warnings = "deny"

I saw this happen:

error: lint group `rust_2018_idioms` has the same priority (0) as a lint
  --> Cargo.toml:77:1
   |
77 | rust_2018_idioms = "deny"
   | ^^^^^^^^^^^^^^^^   ------ has an implicit priority of 0
78 | warnings = "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: `-D clippy::lint-groups-priority` implied by `-D clippy::all`
   = help: to override `-D clippy::all` add `#[allow(clippy::lint_groups_priority)]`
help: to have lints override the group set `rust_2018_idioms` to a lower priority
   |
77 | rust_2018_idioms = { level = "deny", priority = -1 }
   |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I expected to see this happen:

Lint not triggered.

Version

rustc 1.78.0-nightly (d44e3b95c 2024-02-09)
binary: rustc
commit-hash: d44e3b95cb9d410d89cb8ab3233906a33f43756a
commit-date: 2024-02-09
host: x86_64-unknown-linux-gnu
release: 1.78.0-nightly
LLVM version: 17.0.6

Additional Labels

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingI-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