Parameterized lints (unused_must_use)

Some lints should be parameterized, an good example is unused_must_use. Sometimes you want to ignore Result but not ignore anything else:

#[allow(unused_must_use(std::result::Result))]
fn main() {
use std::fs::write as w;
w("foo", foo());
w("bar", bar());
// ...
}

This should be possible.

I think this would require an RFC.

Personally, Iā€™d want to see a lot more use-cases to be convinced that the extra complexity would be worth the gain in functionality. (Why would you want to ignore specifically all Results in a given scope? What other lints would benefit from parametrization?)

3 Likes

Why not use question-mark-in-main and then ? on those writes?

4 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.