cargocompiler-errors95% confidence\u2191 30

How can I only show warnings if there are no errors?

Full error message
Often during development, I have a bunch of unused imports and variables. I like to fix those after I have correctly working code. The warnings these generate cause me to scroll though the cargo build output to find errors among all the warnings.

Is that possible to only show the warnings if compilation succeeds?

I don't want to ignore the warnings entirely, since I do want to solve them before committing the code.

You can suppress warnings in your compilation using the -Awarnings flags. If you use Cargo, you can add it with: cargo rustc -- -Awarnings That will compile your crate with warnings disabled, so only errors will show up. When you get a successful compilation, you can switch back to: cargo build And your crate will compile again (because the flags have changed, the target is no longer up to date) and you will get the detailed warnings. You can try automating them by running: cargo rustc -- -Awarnings && cargo build This has the drawback of compiling the crate twice if there are no errors and that can take some extra time. If you want to compile all the dependencies without the warnings, you can run instead: RUSTFLAGS=-Awarnings cargo build But then, the double compilation issue is quite more relevant. As as side note, I think that some IDEs (VSCode?) are able to do that: sort the compiler messages and filter out the ones you are not interested in.

API access

Get this solution programmatically \u2014 free, no authentication.

curl https://depscope.dev/api/error/1ad36dd12aa37dc8f7a11b20b56cec2ae82e482c47ff6651faa841a76f32abba
hash \u00b7 1ad36dd12aa37dc8f7a11b20b56cec2ae82e482c47ff6651faa841a76f32abba
How can I only show warnings if there are no errors? — DepScope fix | DepScope