Skip to content

-A should override -W when it appears later on the command line #4091

@zackw

Description

@zackw

When more than one -A, -D, or -W option in a clippy invocation refers to the same lint, either directly or indirectly, whichever one came last on the command line should win. The most important reason for this is so you can enable a category of warnings that's off by default, but then turn some of them back off again. For example, suppose src/demo.rs is this:

pub fn demo() -> &'static str {
    "παράδειγμα"
}

then this invocation should not complain about the non-ASCII characters in the string literal, but currently it does:

$ cargo clippy -- -W clippy::pedantic -A clippy::non-ascii-literal
warning: literal non-ASCII character detected
 --> src/demo.rs:2:5
  |
2 |     "παράδειγμα"
  |     ^^^^^^^^^^^^
  |
  = note: `-W clippy::non-ascii-literal` implied by `-W clippy::pedantic`
...

One might also want to be able to do -D warnings -A clippy::something_specific or -W clippy::all -D clippy::particular_bad_thing.

Version information:

$ cargo clippy -V
clippy 0.0.212 (726176e 2019-04-18)

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