When running cargo clippy, is it possible to disable code level annotations?
For instance, in the code (src/lib.rs) I have:
#![allow(warnings)]
// Code follows...
However, when calling (from a CI for instance):
cargo clippy -- -D warnings
code level annotations will take precedence over the ones mentioned on the command line meaning warnings will be allowed.
We don't want the code to be able to bypass CI checks, in this case, clippy lints.
There is the forbid level for lints. So if you call cargo clippy -- -Fclippy::all (or -Fwarnings) every time a lint level is changed in the code an error is produced. Playground
I wouldn't allow(warnings) or allow(clippy::all) during development though. What Clippy does for this is to use a deny-warnings feature, which is then turned on in CI. That way, you still get warnings locally, but CI will error if there are warnings:
TIL about the forbid -f flag. The more you know... thanks!
PS: and yes of course, the allow(warnings) was just as an example.