pre-commit-rust icon indicating copy to clipboard operation
pre-commit-rust copied to clipboard

cargo clean before clippy or it may not work.

Open logannc opened this issue 5 years ago • 1 comments

https://github.com/rust-lang/rust-clippy/issues/1495 and https://github.com/rust-lang/rust-clippy/issues/4612 for details.

In short, clippy is not guaranteed to output results unless a few conditions are satisfied. The easiest of which is running cargo clean before clippy.

There are alternatives that may be preferable for performance, but I suggest this for a simple, easy first pass.

logannc avatar Sep 24 '20 07:09 logannc

For those bothered by this, the obvious solution is to define a bash alias, e.g., alias cargoclippy="cargo clean && cargo clippy". Do so in you .bashrc file (or in an associated file called by .bashrc). Now, running cargoclippy consecutively will continue to print persistent clippy lints. Of course, one may still run cargo clean and cargo clippy in sequence manually, if desired.

LoganDGraham avatar Feb 09 '21 17:02 LoganDGraham