Improving the usefulness of `#[must_use]`

I don't have any exact behaviour in mind. I just know three things,

  1. People keep asking for must_use on more and more functions -- there's something like 1822 instances in the standard library, based on a quick rg.
  2. Most of those have nothing useful to say (unlike, for example, the one on split_off that can point you to use truncate instead, rather than give a generic message)
  3. Yet somehow people apparently don't want to turn on unused_results lint that does tell you about every unused result.

So if people want it on most things, but apparently don't want it on everything, then it sound like the right answer is to infer it in more cases, but have a way to correct things if it's wrong.

2 Likes