rust-lang / rust-lang/rust-clippy
Clippy stops working after printing its version
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 realized that if I run cargo clippy with -- -Vv flag, clippy completely stops working until I either change my source code, or cargo clean.
Reproducer
I tried this code:
/// main.rs
fn main() {
let t = 10;
}
Then I ran cargo clippy and got a warning:
warning: unused variable: `t`
--> src/main.rs:2:6
|
2 | let t = 10;
| ^ help: if this is intentional, prefix it with an underscore: `_t`
|
= note: `#[warn(unused_variables)]` on by default
Then I ran cargo clippy -- -Vv:
rustc 1.62.0 (a8314ef7d 2022-06-27)
binary: rustc
commit-hash: a8314ef7d0ec7b75c336af2c9857bfaf43002bfc
commit-date: 2022-06-27
host: x86_64-unknown-linux-gnu
release: 1.62.0
LLVM version: 14.0.5
Finished dev [unoptimized + debuginfo] target(s) in 0.01s
And when I ran cargo clippy again, it no longer emits that warning:
$ cargo clippy
Finished dev [unoptimized + debuginfo] target(s) in 0.00s
I expected the last cargo clippy to have the same warning as before (unused variable).
If I modify src/main.rs or do a cargo clean, clippy starts working normal again.
Version
rustc 1.62.0 (a8314ef7d 2022-06-27)
binary: rustc
commit-hash: a8314ef7d0ec7b75c336af2c9857bfaf43002bfc
commit-date: 2022-06-27
host: x86_64-unknown-linux-gnu
release: 1.62.0
LLVM version: 14.0.5
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 sequence with the shown src/main.rs: run cargo clippy, cargo clippy -- -Vv, and cargo clippy again, then compare the output. Inspect Clippy's build and caching behavior around the version request; done means the final cargo clippy still reports the unused-variable warning without changing the source or running cargo clean.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100