rust-lang / rust-lang/rust-clippy
`--cap-lints` ignored by `clippy --fix`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the provided Rust code using cargo clippy --fix -- --cap-lints=allow, then compare it with the RUSTFLAGS invocation. Trace how --cap-lints is passed through the Clippy driver and rustfix; done means cargo clippy --fix applies no suggestions when the flag is set to allow.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100