-
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
"Convert match
to let-else" assist
#13254
Comments
We should also adjust existing “convert to early return” assist to use the new syntax |
Probably should handle: let val = match opt {
None => return,
Some(it) => it,
}; As well. |
21 tasks
bors
added a commit
that referenced
this issue
Nov 2, 2022
…-return-assist, r=jonas-schievink Use let-else statements in `Convert to guarded return` assist Follow up for #13516, addresses remaining part of #13254 (comment)
convert-match-to-let-else.mp4 |
Ah, I just noticed this issue. It's a duplicate / subset? of #11908. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
(let-else will be stable in about 6 weeks from now (Rust 1.65); we should probably not ship this assist before then)
It would be nice to have an assist to rewrite
let
statements with amatch
like the following, to their correspondinglet-else
form:->
Criteria for the assist should be:
let
statement whose initializer is amatch
expressionmatch
has 2 arms, the first extracts data, the second has a diverging expressionThe text was updated successfully, but these errors were encountered: