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
Summary
While the
--cap-lintsflag is correctly taken into account when usingcargo clippy, it is ignored when usingcargo clippy --fix.I'm not sure if the unexpected behaviour comes from the clippy driver or from
rustfix, but passing the flags directly usingRUSTFLAGSwork as intended.Reproducer
I tried this code:
running:
cargo clippy --fix -- --cap-lints=allowI expected to see this happen:
Nothing, same behaviour as for
RUSTFLAGS="--cap-lints=allow" cargo clippy --fixInstead, this happened:
Suggestions were applied
Version
Additional Labels
No response