-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Use let...else instead of match foo { ... _ => return }; and if let ... else return
#148837
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
base: main
Are you sure you want to change the base?
Conversation
|
r? @wesleywiser rustbot has assigned @wesleywiser. Use |
This comment has been minimized.
This comment has been minimized.
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.
Maybe skip this for now to avoid conflicts with #148481?
|
do we have a style check for this? |
|
@chenyukang there's a pedantic clippy lint that we could enable: https://rust-lang.github.io/rust-clippy/master/index.html#/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.
Thanks for taking time on this, looks good on compiler side, would this reasonable to split compiler and library parts? I'm not sure if I privileged enough to review the library part
There is some places that looks better with the if let guard feature to remove nesting
This comment was marked as outdated.
This comment was marked as outdated.
This comment has been minimized.
This comment has been minimized.
f61284d to
9c1998b
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| // tidy-alphabetical-start | ||
| #![cfg_attr(bootstrap, feature(array_windows))] | ||
| #![deny(clippy::manual_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.
let's not add this lint anywhere yet, I think CI will never stop complain about it :D
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'm finding them instructive :)
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.
ah, so feel free to «r=me» once CI passed
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…bilee
Use `let`...`else` instead of `match foo { ... _ => return };` and `if let ... else return` in std
Split off rust-lang#148837.
…bilee
Use `let`...`else` instead of `match foo { ... _ => return };` and `if let ... else return` in std
Split off rust-lang#148837.
…bilee
Use `let`...`else` instead of `match foo { ... _ => return };` and `if let ... else return` in std
Split off rust-lang#148837.
Use `let`...`else` instead of `match foo { ... _ => return };` and `if let ... else return` in std
Split off rust-lang/rust#148837.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
☔ The latest upstream changes (presumably #149645) made this pull request unmergeable. Please resolve the merge conflicts. |
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
@bors r=Kivooeo |
Use `let...else` instead of `match foo { ... _ => return };` and `if let ... else return`
No description provided.