Skip to content

--cap-lints ignored by clippy --fix #9703

@kraktus

Description

@kraktus

Summary

While the --cap-lints flag is correctly taken into account when using cargo clippy, it is ignored when using cargo clippy --fix.

I'm not sure if the unexpected behaviour comes from the clippy driver or from rustfix, but passing the flags directly using RUSTFLAGS work as intended.

Reproducer

I tried this code:

pub struct Foo;

impl Foo {
    pub fn new() -> Foo { // new_without_default AND use_self
        Self
    }
}

fn main() {
    let a: u8; // unused_variables
}

running: cargo clippy --fix -- --cap-lints=allow

I expected to see this happen:

Nothing, same behaviour as for RUSTFLAGS="--cap-lints=allow" cargo clippy --fix

Instead, this happened:

Suggestions were applied

Version

rustc 1.64.0 (a55dd71d5 2022-09-19)
binary: rustc
commit-hash: a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52
commit-date: 2022-09-19
host: aarch64-apple-darwin
release: 1.64.0
LLVM version: 14.0.6

Additional Labels

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-uiArea: Clippy interface, usage and configurationC-bugCategory: Clippy is not doing the correct thing

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions