Skip to content

Commit bbe2264

Browse files
committed
Add unwrap block assist #4156
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
1 parent 76733f0 commit bbe2264

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

crates/ra_assists/src/doc_tests/generated.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,7 @@ fn foo() {
740740
"#####,
741741
r#####"
742742
fn foo() {
743-
<|>println!("foo");
743+
println!("foo");
744744
}
745745
"#####,
746746
)

crates/ra_assists/src/handlers/unwrap_block.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use ra_syntax::{ast, AstNode};
66

77
// Assist: unwrap_block
88
//
9-
// Removes the `mut` keyword.
9+
// This assist removes if...else, for, while and loop control statements to just keep the body.
1010
//
1111
// ```
1212
// fn foo() {
@@ -18,7 +18,7 @@ use ra_syntax::{ast, AstNode};
1818
// ->
1919
// ```
2020
// fn foo() {
21-
// <|>println!("foo");
21+
// println!("foo");
2222
// }
2323
// ```
2424
pub(crate) fn unwrap_block(ctx: AssistCtx) -> Option<Assist> {

docs/user/assists.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ use std::{collections::HashMap};
698698

699699
## `unwrap_block`
700700

701-
Removes the `mut` keyword.
701+
This assist removes if...else, for, while and loop control statements to just keep the body.
702702

703703
```rust
704704
// BEFORE
@@ -710,6 +710,6 @@ fn foo() {
710710

711711
// AFTER
712712
fn foo() {
713-
println!("foo");
713+
println!("foo");
714714
}
715715
```

0 commit comments

Comments
 (0)