Why clippy doesnt report anything after update/cargo check and how to solve it

Apr 30, 2020 • 2 minutes to read

Clippy is a nice tool to improve code quality on Rust projects but he has a little issue which is pretty annoying over time.

When clippy run and display errors to fix and you fix a single one or you run cargo check, the next time clippy run he will display no errors anymore. Weird right?

Here’s a simple tricks to make it work again.

Some people are using touch src/lib.rs to trigger a white modification and be able to run clippy again. But it ain’t cool at all…

Instead some other people are using cargo clean to force clippy to re-analyse the whole crate but it heavy because you need to recompile every dependencies.

You can specify the crate to clean with this cargo clean -p YOUR_CRATE. With this you will only clean the desired crate and you will have a faster compilation.

This issue was referenced for a while on clippy repository and it seems that they are close to solve this annoying bug with a flag.

On nightly you can already run it with cargo clippy -Zunstable-options.

Hope it helps!


Here’s the related issues on clippy's repository:

rust

Cfg Test and Cargo Test a Missing Information