Note

This bug has been fixed, as of Rust 1.52 released on May 6th 2021.

Currently there's a bug with Clippy, where executing cargo clippy after cargo check, results in Clippy not reporting any lints. (Issue #4612)

I commented a workaround on the thread the other day. Which in short simply involves touching all Rust files, to trigger them all to be recompiled.

In short, while your current working directory is your Rust crate, then execute the following, before executing cargo clippy:

find -name "*.rs" -not -path "./target/*" -exec touch "{}" +

Since it's quite a handful to type every time, I personally added the following function to my .bashrc file:

clippy() {(
    set -e
    find -name "*.rs" -not -path "./target/*" -exec touch "{}" +
    cargo clippy "$@"
)}

All in all, now I simply have to type clippy.