Skip to content

A newly created clippy.toml does not trigger a rebuild #9928

Open
@jimblandy

Description

@jimblandy

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions