It makes a lot of sense to add #[must_use] for methods in the Colorize trait.
I discovered It funnily by writing this code:
fn foo(s: &mut str) {
// ...
s.clear();
}
Of course, I should have used &mut String for my mutable buffer. But this compiled just fine since it calls Colorized::clear. With #[must_use], it would be easier to spot.
Even without this example, I think #[must_use] is a viable addition.
It makes a lot of sense to add
#[must_use]for methods in theColorizetrait.I discovered It funnily by writing this code:
Of course, I should have used
&mut Stringfor my mutable buffer. But this compiled just fine since it calls Colorized::clear. With#[must_use], it would be easier to spot.Even without this example, I think
#[must_use]is a viable addition.