-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix option_if_let_else
when Err
variant is ignored
#14429
base: master
Are you sure you want to change the base?
Conversation
r? @Manishearth rustbot has assigned @Manishearth. Use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching this. Since the issue had been closed and not reopened, this apparently flew under the radard.
Can you add a "Fixes #10335" in the PR description and squash your 3 commits into one?
4c7b478
to
9f49773
Compare
@@ -188,14 +188,32 @@ LL + true | |||
LL + }) | |||
| | |||
|
|||
error: use Option::map_or_else instead of an if let/else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue: this lint says Option, and has Option in its name, we should probably not be linting here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we already lint on Result here.
Tbh I'm not convinced of the value of this lint overall, we should probably have a team discussion about it, but separately to that we shoudl figure out if it should also handle Result in the same lint (and if so, it needs to be updated)
This fixes an issue where clippy suggests passing a function that takes no arguments as the first argument of
Result::map_or_else
. The function needs to take one argument. Example that triggers the issue: Playground linkFixes #10335.
changelog: [
option_if_let_else
]: fix incorrect suggestion when the contents of anErr
variant are ignored