Why does clippy not always display suggestions for me?

I've found that if I run cargo clippy it will display a bunch of suggestions, but if I run it again it won't show me any.

Why is this and how can I get it to display them again?

You need to touch the files again. Clippy caches results and doesn't redo work if it is cached (this behavior is being changed). All you need to do is update the file's last edit time. You can use the touch command on linux or just make a tiny whitespace edit and save it to force clippy to re-run.

Because of the cache.

Just like you run cargo run twice.

You need to make some changes to tell the cargo recompile this part. (avoid cargo clean if your project has a lot deps, it will take a long time to recompile the unnecessary parts

But why is displaying the results tied to doing the actual linting work? Shouldn't it still display the results even if the files weren't touched, just not recompute anything?

It looks st the cache and sees that it already displayed the results and the file has not been edited, so it bails. This is the same behavior as cargo build and cargo check. This behavior is unfortunate for clippy because we often do want the results again, and I remember seeing a github issue to change it to force clippy to always run, regardless of the cache.

It looks like it may be fairly close to finally getting addressed!


Actually, if you invoke clippy this way, it should work!