bors[bot] 4ec6bd6206
Merge #11017
11017: Support "move if to guard" with an else branch r=Veykril a=weirane

Support the assist `move_arm_cond_to_match_guard` when there is an else branch.

I have two questions:
1. How to indent the first line of a match arm? `matcharm.indent()` doesn't seem to work. so I hard coded four spaces here:
95a0de85d5/crates/ide_assists/src/handlers/move_guard.rs (L162-L163)

2. I find a little issue in the original implementation, this code
```rust
let y = match 92 {
    x => {
        if x == 0 {$0
            false
        }
    }
    _ => true,
};
```
will be transformed to
```rust
let y = match 92 {
    x if x == 0 => false
    _ => true,
};
```
a comma is missing after the `false`. Should I also fix that? Or this can go in a separate PR.

Closes #10997.

Co-authored-by: Wang Ruochen <wrc@ruo-chen.wang>
2021-12-15 23:04:51 +00:00
..
2021-11-30 14:07:39 +00:00
2021-12-14 12:38:20 +01:00
2021-12-10 14:19:51 +00:00
2021-12-11 14:49:29 +00:00
2021-12-14 15:57:58 +08:00
2021-12-15 23:04:51 +00:00
2021-12-12 19:22:37 +03:00
2021-12-12 19:36:14 +03:00
2021-12-04 15:14:31 +02:00
2021-12-10 20:01:24 +01:00