You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the Err closure does nothing else except return None, and...
the Ok parameter is Some
There is already a lint result_map_or_into_option but that only covers r.map_or(None, Some), so this can either be a new lint or result_map_or_into_option can be extended to also check for this.
Lint Name
result_map_or_else_into_option
Category
style
Advantage
The suggested code makes it more obvious what the code is doing.
…sion, r=flip1995
Extend `result_map_or_into_option` lint to handle `Result::map_or_else(|_| None, Some)`
Fixes#10365.
As indicated in the title, it extends the `result_map_or_into_option` lint to handle `Result::map_or_else(|_| None, Some)`.
changelog: extension of the `result_map_or_into_option` lint to handle `Result::map_or_else(|_| None, Some)`
r? `@blyxyas`
What it does
See title and example.
This lint should only fire if:
Err
closure does nothing else except returnNone
, and...Ok
parameter isSome
There is already a lint
result_map_or_into_option
but that only coversr.map_or(None, Some)
, so this can either be a new lint orresult_map_or_into_option
can be extended to also check for this.Lint Name
result_map_or_else_into_option
Category
style
Advantage
The suggested code makes it more obvious what the code is doing.
Drawbacks
None.
Example
Could be written as:
The text was updated successfully, but these errors were encountered: