This is a simple solution to a simple problem: it allow signaling to the compiler that a type marked as must_use can safely be ignored in this instance.
for example:
/// try to open a file before it is required.
///
/// this result can be safely ignored,
/// as the file will be automatically opened again
/// when it is actually needed.
#[must_use = false]
pub fn hint_premptive_open(&mut self) -> io::Result<()> {
}
I don't think we should add more attributes written like #[attr = value]. This should be something like #[must_use(false)] or #[no_must_use] or #[may_ignore].
Any reason? I think the inclusion of the equal sign makes the meaning more apparent, where as must_use(false) seems more like you need to use the value false.
Also, strictly speaking, this isn't introducing another attribute, it's simply adding another possible to an existing attribute.
i feel like this could be very easily lifted on attribute helper macros, and should be, since those macros are just inert data that is fed into other macros.
You know how we had wildcard matches as base cases, but decided it would be nice if some matches could be proven to be exhaustive and not require wildcard matches? So then you couldn't add a variant to the enum or struct without it becoming obvious at all match sites?
You remember how we then decided it would be nice if library authors could force users to write wildcard matches to maintain backward compatibility, so we added #[non_exhaustive]?
You remember how people then said they'd rather have the breakage from the exhaustive match, so we added a lint for non-exhaustive matches on #[non_exhaustive] types?
...that result has felt a bit like a silly place to wind up in. Not bad per se, but that it might have been avoidable by thinking either slightly more expansively or trying to think one step ahead.
This feels a bit like that. I'm left wondering if the opt-in/opt-out of lints design space is worth thinking about more carefully.