How to hide warnings

How to configure cargo to show only errors?

1 Like

You could put #![allow(warnings)] in your project's main file (main.rs or lib.rs, depending on the type of crate; on top of the file). Or set an RUSTFLAGS="-Awarnings" environment variable. I'm not sure why you'd ever want to disable warnings though; they're super useful, you should always aim to fix all the default-enabled warnings before considering your code done.

2 Likes

I'd like to disable warnings during the initial stage of developing where I'm still fixing hard errors, so I can concentrate on those, not to have to scroll through warnings in order to see errors every time I try to build.
Does that make sense?

Yep, makes sense. In this case, the addition to source code makes is probably the easiest approach.

Some of the most common, and even expected, warnings during development are the ones about unused code; you can disable all of those with a single #![allow(unused)] maybe that's enough for you; some of the other warnings can be quite useful even during development.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.