rust-lang / rust-lang/rust-clippy
A newly created clippy.toml does not trigger a rebuild
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
Summary
If results from a previous run are present, Clippy ignores changes to a "clippy.toml" file. This makes debugging frustrating, because Clippy's outputs are not a function of its current ostensible inputs.
The following transcript shows that, even if clippy.toml has invalid contents, Clippy doesn't notice until cargo clean removes its cached results.
$ cargo clean
$ cargo clippy
Checking play-clippy v0.1.0 (/home/jimb/rust/play-clippy)
warning: the `Err`-variant returned from this function is very large
--> src/main.rs:3:13
|
3 | fn foo() -> Result<(), Error> {
| ^^^^^^^^^^^^^^^^^ the `Err`-variant is at least 4000 bytes
|
= note: `#[warn(clippy::result_large_err)]` on by default
= help: try reducing the size of `Error`, for example by boxing large elements or replacing it with `Box<Error>`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#result_large_err
warning: `play-clippy` (bin "play-clippy") generated 1 warning
Finished dev [unoptimized + debuginfo] target(s) in 0.13s
$ echo 'msrv = "slurve"' > clippy.toml
$ cargo clippy
warning: the `Err`-variant returned from this function is very large
--> src/main.rs:3:13
|
3 | fn foo() -> Result<(), Error> {
| ^^^^^^^^^^^^^^^^^ the `Err`-variant is at least 4000 bytes
|
= note: `#[warn(clippy::result_large_err)]` on by default
= help: try reducing the size of `Error`, for example by boxing large elements or replacing it with `Box<Error>`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#result_large_err
warning: `play-clippy` (bin "play-clippy") generated 1 warning
Finished dev [unoptimized + debuginfo] target(s) in 0.00s
$ cargo clean
$ cargo clippy
Checking play-clippy v0.1.0 (/home/jimb/rust/play-clippy)
error: error reading Clippy's configuration file. `slurve` is not a valid Rust version
error: could not compile `play-clippy` due to previous error
$
Reproducer
I tried this code:
<code>
I expected to see this happen:
Instead, this happened:
Version
No response
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 transcript with cargo clippy, creating clippy.toml after an initial successful run. Trace how Clippy configuration changes participate in rebuild invalidation; done when creating or changing an invalid clippy.toml causes the next cargo clippy run to notice it and report the configuration error without cargo clean.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100