External Publication
Visit Post

Pre-feature request: suppress unused variable warning for unit-type arguments

Rust Internals [Unofficial] March 11, 2026
Source

zackw:

but does it make more sense to you if I say that the main thing I don't like about shutting up the warning with a leading _, in this case, is that I will then have to remove that leading _ when, inevitably, the subcommand grows some options?

It makes sense, but I feel like that's why, unique among many other lints, we make it possible to suppress this as simply as adding _ rather than having to write out something like expect(...). It's one character. And almost definitionally, you'll only need to change that _ in one place, because you won't have any other references to it.

Discussion in the ATmosphere

Loading comments...