rust-lang / rust-lang/rust-clippy
`clippy --fix -- -Dwarnings` does not fail on warnings
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
Summary
I have cargo clippy -- -Dwarnings correctly fail on warnings.
However, cargo clippy --fix -- -Dwarnings succeeds on warnings (that is, exists with 0 error code).
I'm not sure whether https://github.com/rust-lang/cargo/issues/8424 will help here. Cc #1209 where I got the idea for -Dwarnings.
I'm not sure whether this is a bug or a surprising behavior, but if it is intentional, it should be
mentioned in cargo clippy --help or somewhere, as well as somewhere in https://doc.rust-lang.org/nightly/clippy/usage.html#command-line.
Reproducer
Any code with warnings, e.g.
#![allow(clippy::style)]
#[warn(clippy::double_neg)]
fn main() {
let x = 1;
let y = --x;
}
Version
rustc 1.83.0-nightly (7042c269c 2024-09-23)
binary: rustc
commit-hash: 7042c269c166191cd5d8daf0409890903df7af57
commit-date: 2024-09-23
host: aarch64-apple-darwin
release: 1.83.0-nightly
LLVM version: 19.1.0
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
Start by reproducing the issue with cargo clippy -- -Dwarnings and cargo clippy --fix -- -Dwarnings using the provided Rust example. Investigate the command-line behavior and determine whether --fix should return a nonzero status for remaining warnings. Done means the behavior is corrected or the difference is documented in cargo clippy --help and the Clippy usage page.
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