New lint: suggest the use of Result::unwrap_or_else over Result::map_or_else #7328
Labels
C-enhancement
Category: Enhancement of lints, like adding more cases or adding help messages
good-first-issue
These issues are a good way to get started with Clippy
What it does
Suggest the use of
Result::unwrap_or_else
overResult::map_or_else
ifmap_or_else
is just used to unpack a successful result while handling an error.Categories (optional)
What is the advantage of the recommended code over the original code
Code will be shorter (and cleaner).
Drawbacks
None.
Example
Could be written as:
The text was updated successfully, but these errors were encountered: