Skip to content
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

Add replace_match_with_if_let assist #6731

Merged
merged 1 commit into from Dec 7, 2020

Conversation

Veykril
Copy link
Member

@Veykril Veykril commented Dec 5, 2020

Basically the counterpart to replace_if_let_with_match, I personally sometimes want to replace matches like

match foo {
    pat => expr,
    _ => (),
}

into the corresponding

if let pat = foo {
    expr
}

which is the main reasoning behind this.
I put this into the same file as replace_if_let_with_match because the are complementing each other and I would probably rename the file to something like replace_if_let_match but I didn't do that for now because I was unsure whether git would still view this as a rename or not due to the amount of changes in the file so that the diff is still properly visible for now.

@matklad
Copy link
Member

matklad commented Dec 7, 2020

Yesssss!

I've been wanting this for aeons!

bors r+

@bors
Copy link
Contributor

bors bot commented Dec 7, 2020

@bors bors bot merged commit 6df91a8 into rust-lang:master Dec 7, 2020
@Veykril Veykril deleted the replace_match_with_if_let branch December 7, 2020 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants