about summary refs log tree commit diff
path: root/src/test/codegen/src-hash-algorithm
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-12-15 23:04:51 +0000
committerGitHub <noreply@github.com>2021-12-15 23:04:51 +0000
commit4ec6bd6206af70494bf61cf03ef892568d942cbf (patch)
treecc430f4b8b99adac13c3e8f88d5fefc26190c27a /src/test/codegen/src-hash-algorithm
parent661e3f933ab359ecafe2d10ab8b1d1da0d7fe5fc (diff)
parente8d074299761eff8f81215c78e55e5d3e98ada26 (diff)
downloadrust-4ec6bd6206af70494bf61cf03ef892568d942cbf.tar.gz
rust-4ec6bd6206af70494bf61cf03ef892568d942cbf.zip
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:
https://github.com/weirane/rust-analyzer/blob/95a0de85d5d659e876e731725475f1c022719f31/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>
Diffstat (limited to 'src/test/codegen/src-hash-algorithm')
0 files changed, 0 insertions, 0 deletions