How to make Clippy fail on warnings, but keep warnings printed as warnings? #11942
-
Relatively new to Rust and Clippy. I'm trying to create a justfile recipe that first runs Clippy ( One way to make Clippy exit with non-zero status on warnings is to append How to make Clippy exit with non-zero status when there were warnings, but keep warnings printed as warnings? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
No this is not possible and that's by design. In Rust, warnings are considered (almost) as problematic as errors. So CI systems are usually set up to treat warnings as errors ( The reason, why warnings will give exit status Also read about the TL;DR: What you want to do is to keep warnings as warnings locally and in CI set |
Beta Was this translation helpful? Give feedback.
-
Looks like this question stemmed from a misconception. To make sure I understood flip1995's answers correctly:
Do I have it right? |
Beta Was this translation helpful? Give feedback.
If you specify
deny(warnings)
or-Dwarnings
you tell the Rust compiler (or Clippy) that you want to fail compilation on warnings. That's exactly what this flag (or attribute) means.In that case, you might want to set
-Dwarnings
in only theJustfile
where you want to fail on warnings and not in those where you don't.