-
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
FN single_match_else #3489
Comments
I also prefer using
|
Looking at this again
is equivalent to
which is a common pattern and shouldn't be linted IMO. If anything is changed, I think clippy shouldn't lint for the second pattern either. |
This lint currently doesn't lint cases where the "else" part of the 2 arm match is a single statement/expression. The bug lies in that One approach would be to consider single statement blocks equivalently. That would join @mikerite's last comment. That is, the three following examples wouldn't be linted. match Some(1) => {
Some(_) => {...}
None => return 1,
} match Some(1) => {
Some(_) => {...}
None => { return 1 },
} // this case is currently linted match Some(1) => {
Some(_) => {...}
None => { return 1; },
} |
clippy 0.0.212 (b2601be 2018-11-27)
I had this code which did not trigger any lints:
After applying rustfmt, an additional
;
was added:which caused clippy::single_match_else to trigger.
I think the link should also trigger on the unformatted example!
The text was updated successfully, but these errors were encountered: