-
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
Warn about using bool::then_some
followed by unwrap_or
, suggest if
/else
instead
#9100
Labels
A-lint
Area: New lints
Comments
This should also apply with any combination of |
@rustbot claim |
bors
added a commit
that referenced
this issue
Jul 18, 2022
Add new lint `obfuscated_if_else` part of #9100, additional commits could make it work with `then` and `unwrap_or_else` as well changelog: Add new lint `obfuscated_if_else`
My commit adds the lint for |
github-merge-queue bot
pushed a commit
that referenced
this issue
Jan 25, 2025
part of #9100 The `obfuscated_if_else` lint currently only triggers for the pattern `.then_some(..).unwrap_or(..)`, but there're other cases where this lint should be triggered, one of which is `.then(..).unwrap_or(..)`. changelog: [`obfuscated_if_else`]: trigger lint for the `.then(..).unwrap_or(..)` pattern as well
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What it does
Detects the combination of
then_some
followed byunwrap_or
in place of a more clearif
/else
.Lint Name
bool_if_else
Category
style
Advantage
Drawbacks
No response
Example
Could be written as:
The text was updated successfully, but these errors were encountered: