rust-analyzer/crates
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
..
base_db Merge #10872 2021-11-30 14:07:39 +00:00
cfg Replace some String usages with SmolStr in completions 2021-11-05 12:30:39 +01:00
flycheck Don't discard flycheck error messages 2021-11-27 18:57:51 +01:00
hir Simplify 2021-12-14 12:38:20 +01:00
hir_def Merge #10977 2021-12-10 14:19:51 +00:00
hir_expand Merge #10877 2021-12-11 14:49:29 +00:00
hir_ty fixes broken tests 2021-12-14 15:57:58 +08:00
ide Move out doc-links tests into a separate module 2021-12-14 12:10:43 +01:00
ide_assists Merge #11017 2021-12-15 23:04:51 +00:00
ide_completion match_ast! takes a pattern to allow underscore usage 2021-12-14 12:44:31 +01:00
ide_db match_ast! takes a pattern to allow underscore usage 2021-12-14 12:44:31 +01:00
ide_diagnostics fix: lookup upwards for struct and enum 2021-12-12 01:23:27 +09:00
ide_ssr Move ws insert rendering for macro expansion into ide_db 2021-12-13 15:55:13 +01:00
limit Drop resolver and authors manifest entries 2021-10-25 18:12:40 +03:00
mbe tighten up invariants 2021-12-12 19:22:37 +03:00
parser prettyfy 2021-12-12 19:36:14 +03:00
paths Set MSRV 2021-10-23 15:07:11 +03:00
proc_macro_api Add support for v6 macro metadata format 2021-12-13 18:15:22 +02:00
proc_macro_srv Fix proc macro ABI version checks 2021-11-18 10:24:24 +02:00
proc_macro_test Set MSRV 2021-10-23 15:07:11 +03:00
profile Bump countme 2021-12-04 15:14:31 +02:00
project_model Fix library target overriding sysroot deps 2021-12-08 17:05:00 +01:00
rust-analyzer internal: add "Shuffle Crate Graph" command 2021-12-07 16:37:19 +01:00
sourcegen Set MSRV 2021-10-23 15:07:11 +03:00
stdx Remove some allocations 2021-12-10 20:01:24 +01:00
syntax match_ast! takes a pattern to allow underscore usage 2021-12-14 12:44:31 +01:00
test_utils Set MSRV 2021-10-23 15:07:11 +03:00
text_edit Update crates/text_edit/src/lib.rs 2021-11-03 15:44:46 +01:00
toolchain Set MSRV 2021-10-23 15:07:11 +03:00
tt Set MSRV 2021-10-23 15:07:11 +03:00
vfs minor: Lift out FxIndex{Map/Set} types into ide_db 2021-11-16 12:15:47 +01:00
vfs-notify Set MSRV 2021-10-23 15:07:11 +03:00