Enforce adding explanations for unwrap

I have unwraps in my code that are safe to do and I use comments to indicate why it is okay to unwrap. However, I was wondering if there is a way (maybe extending clippy for e.g) or other approaches that folx have used to detect unwraps in the code that don't include an explanation. Thanks!

No, if that would be enforced, that would likely break a fair amount of code.

However, there are {Result, Option}::expect() which may fit your needs.


And you can even enforce always using expect instead of unwrap with #![deny(clippy::unwrap_used)].


Thank you for the tips!