diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-06-02 18:25:11 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-06-02 18:25:11 +0100 |
commit | 5be653d426e3e3fd253f41f85e7d280a82037da9 (patch) | |
tree | 044781a4271b8175b76309c7bd7a6e376a4914ea /crates/cfg/src/tests.rs | |
parent | a421482e7515414ae4e5e9f76bf997c7f1e7398b (diff) | |
parent | 7d2710218f176f0f8e2bb86288084559a358dc7d (diff) |
Merge #9108
9108: Don't show extract into variable assist for unit expressions r=jonas-schievink a=brandondong
**Reproduction:**
```rust
fn main() {
let mut i = 3;
$0if i >= 0 {
i += 1;
} else {
i -= 1;
}$0
}
```
1. Select the snippet of code between the $0's.
2. The extract into variable assist shows up, pushing down the more useful extract into function assist.
3. The resulting output of selecting the extract into variable assist is valid but with the extracted variable having the unit type:
```rust
fn main() {
let mut i = 3;
let var_name = if i >= 0 {
i += 1;
} else {
i -= 1;
};
var_name
}
```
**Fix:**
- Don't show the extract into variable assist for unit expressions. I could not think of any scenarios where such a variable extraction would be desired.
Co-authored-by: Brandon <[email protected]>
Diffstat (limited to 'crates/cfg/src/tests.rs')
0 files changed, 0 insertions, 0 deletions