rust/crates
bors[bot] 190f37afab
Merge #9600
9600: fix: Single-line and nested blocks in the `unwrap_block` assist r=Veykril a=patrick-gu

Fixes #8411

Rework the system for stripping whitespace and braces in the unwrap_block assist to allow correct unwrapping of blocks such as:
```rust
{ $0 0 }
```
into
```rust
0
```

and nested blocks, such as:
```rust
$0{
    {
        3
    }
}
```
into
```rust
{
    3
}
```

This is done by creating the `update_expr_string_with_pat` function (along with `update_expr_string` and `update_expr_string_without_newline`), which strips whitespace and braces in a way that ensures that only whitespace and a maximum of one brace are removed from the start and end of the expression string.

I have also created several tests to ensure that this functionality works correctly.

Co-authored-by: patrick-gu <55641350+patrick-gu@users.noreply.github.com>
2021-07-15 00:45:55 +00:00
..
base_db minor: drop dummy authors field 2021-07-05 14:19:41 +03:00
cfg minor: drop dummy authors field 2021-07-05 14:19:41 +03:00
flycheck cargo_metadata 0.14 2021-07-09 11:01:55 -04:00
hir internal: get rid of a call to slow O(N) visibility_of function 2021-07-12 21:13:43 +03:00
hir_def internal: get rid of a call to slow O(N) visibility_of function 2021-07-12 21:13:43 +03:00
hir_expand Update list of safe intrinsics 2021-07-08 15:49:39 +02:00
hir_ty Add test for #9560 2021-07-11 16:14:39 +02:00
ide Merge #9595 2021-07-15 00:20:44 +00:00
ide_assists fix: Single-line and nested blocks in unwrap_block 2021-07-14 12:02:38 -07:00
ide_completion Update tests 2021-07-14 18:20:01 +02:00
ide_db internal: get rid of a call to slow O(N) visibility_of function 2021-07-12 21:13:43 +03:00
ide_diagnostics internal: remove one more needless extern crate 2021-07-11 15:48:49 +03:00
ide_ssr minor: drop dummy authors field 2021-07-05 14:19:41 +03:00
mbe minor: drop dummy authors field 2021-07-05 14:19:41 +03:00
parser minor: drop dummy authors field 2021-07-05 14:19:41 +03:00
paths minor: drop dummy authors field 2021-07-05 14:19:41 +03:00
proc_macro_api Address review comments 2021-07-12 15:19:53 +02:00
proc_macro_srv Introduce proc_macro_srv::abis, impl 1.47 and 1.55 2021-07-12 16:05:45 +01:00
proc_macro_test cargo_metadata 0.14 2021-07-09 11:01:55 -04:00
profile minor: drop dummy authors field 2021-07-05 14:19:41 +03:00
project_model Set more CARGO_ env vars 2021-07-12 15:34:49 +02:00
rust-analyzer Show test mod runnable in outline modules 2021-07-14 11:30:51 +02:00
sourcegen minor: make sure that project_root works correctly 2021-07-13 15:02:29 +03:00
stdx Remove proc macro management thread 2021-07-08 16:43:39 +02:00
syntax Merge #9557 2021-07-10 17:25:16 +00:00
test_utils Update inline_call assist doc example 2021-07-05 14:24:25 +02:00
text_edit minor: drop dummy authors field 2021-07-05 14:19:41 +03:00
toolchain minor: drop dummy authors field 2021-07-05 14:19:41 +03:00
tt minor: drop dummy authors field 2021-07-05 14:19:41 +03:00
vfs minor: drop dummy authors field 2021-07-05 14:19:41 +03:00
vfs-notify This patch shortens the spawned threads' names, as threads on Linux 2021-07-08 18:27:54 +05:30