Skip to content

-A --allow should take precedence over -D --deny in CLI #4778

Closed
rust-lang/rust
#67885
@tyranron

Description

@tyranron

I have a weird issue, where I cannot disable a single lint via command line.

Running the following

cargo +beta clippy --all -- -D clippy::pedantic -D warnings \
	                    -A clippy::must_use_candidate

still results in lint being applied:

error: this method could have a `#[must_use]` attribute
  --> crates/tracerr/src/trace.rs:50:5
   |
50 |     fn deref(&self) -> &Vec<Frame> {
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add the attribute: `#[must_use] fn deref(&self) -> &Vec<Frame>`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#must_use_candidate

Changing the order of the CLI arguments doesn't affect anything.

While disabling lint via !#[allow(clippy::must_use_candidate)] attribute in crate's root works OK, as expected.

I suggest that things listed in allow (no matter where) as a white list should take precedence over deny as a black list.

❯ cargo +beta clippy -- --version
clippy 0.0.212 (c8e3cfbd 2019-10-28)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions