]> git.lizzy.rs Git - rust.git/commit
Merge #6731
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>
Mon, 7 Dec 2020 15:00:07 +0000 (15:00 +0000)
committerGitHub <noreply@github.com>
Mon, 7 Dec 2020 15:00:07 +0000 (15:00 +0000)
commit6df91a84dc129b13dc58db510e68c5eb04297087
tree277812e8a9562861925fad7bd7c91321bf79c4f7
parent403ed489ff51e4b1d9b1bbde1ddb6f765ebcbd1f
parent44c76d6550081552c3c5106b0535a7e5bf265aec
Merge #6731

6731: Add replace_match_with_if_let assist r=matklad a=Veykril

Basically the counterpart to `replace_if_let_with_match`, I personally sometimes want to replace matches like
```rust
match foo {
    pat => expr,
    _ => (),
}
```
into the corresponding
```rust
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.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>