Do not show warnings

How to set up cargo to stop seeing warnings (during compilation)?

On Linux or Mac:

RUSTFLAGS=-Awarnings cargo build

Powershell:

$env:RUSTFLAGS = '-Awarnings'; 
cargo build

You can also add this to the top of the file you wish to disable warnings in:

#![allow(warnings)]
2 Likes

Thanks!

I strongly suggest being more targeted about which ones you hide, as a bunch of them are very important.

Consider, for example,

#![cfg_attr(test, allow(dead_code))]

if you want to hide the warnings that things aren't used yet while you're in a cargo test iteration loop.

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.