External Publication
Visit Post

Custom Cargo Command to Show Only Errors (Avoid Setting RustFLAGS Every Time)

Rust Internals [Unofficial] February 24, 2026
Source

RUSTFLAGS (like most env variables) is a terrible interface for anything that you don't set once in your login script and then forget about it. Sometimes it can be useful to set it once in your current session, but because it's entirely hidden state you're going to forget it and then be confused why, for example, one of your terminal windows gives different output than the one next to it. Anything you might want to ever change more often than that should be a command-line parameter and a per-profile setting in Cargo.toml so you can have separate "devloop" and "now I care about warnings" profiles. Cargo is well known for having some idiosyncratic opinions as to what goes to Cargo.toml, what goes to .cargo/config.toml, what can be set on the command line, and what requires the use of RUSTFLAGS, that don't quite match many valid workflows that people have (I know there are efforts to alleviate some of these mismatches).

Discussion in the ATmosphere

Loading comments...