diff options
author | Benjamin Coenen <[email protected]> | 2020-04-29 13:53:47 +0100 |
---|---|---|
committer | Benjamin Coenen <[email protected]> | 2020-04-29 13:53:47 +0100 |
commit | bbe22640b8d52354c3de3e126c9fcda5b1b174fd (patch) | |
tree | 19faa271db52dd248f2ba0e67f933ba66b19b08a | |
parent | 76733f0cd456005295e60da8c45d74c8c48f177c (diff) |
Add unwrap block assist #4156
Signed-off-by: Benjamin Coenen <[email protected]>
-rw-r--r-- | crates/ra_assists/src/doc_tests/generated.rs | 2 | ||||
-rw-r--r-- | crates/ra_assists/src/handlers/unwrap_block.rs | 4 | ||||
-rw-r--r-- | docs/user/assists.md | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/crates/ra_assists/src/doc_tests/generated.rs b/crates/ra_assists/src/doc_tests/generated.rs index 6fe95da6a..b53b97e89 100644 --- a/crates/ra_assists/src/doc_tests/generated.rs +++ b/crates/ra_assists/src/doc_tests/generated.rs | |||
@@ -740,7 +740,7 @@ fn foo() { | |||
740 | "#####, | 740 | "#####, |
741 | r#####" | 741 | r#####" |
742 | fn foo() { | 742 | fn foo() { |
743 | <|>println!("foo"); | 743 | println!("foo"); |
744 | } | 744 | } |
745 | "#####, | 745 | "#####, |
746 | ) | 746 | ) |
diff --git a/crates/ra_assists/src/handlers/unwrap_block.rs b/crates/ra_assists/src/handlers/unwrap_block.rs index b98601f1c..35d87bc9e 100644 --- a/crates/ra_assists/src/handlers/unwrap_block.rs +++ b/crates/ra_assists/src/handlers/unwrap_block.rs | |||
@@ -6,7 +6,7 @@ use ra_syntax::{ast, AstNode}; | |||
6 | 6 | ||
7 | // Assist: unwrap_block | 7 | // Assist: unwrap_block |
8 | // | 8 | // |
9 | // Removes the `mut` keyword. | 9 | // This assist removes if...else, for, while and loop control statements to just keep the body. |
10 | // | 10 | // |
11 | // ``` | 11 | // ``` |
12 | // fn foo() { | 12 | // fn foo() { |
@@ -18,7 +18,7 @@ use ra_syntax::{ast, AstNode}; | |||
18 | // -> | 18 | // -> |
19 | // ``` | 19 | // ``` |
20 | // fn foo() { | 20 | // fn foo() { |
21 | // <|>println!("foo"); | 21 | // println!("foo"); |
22 | // } | 22 | // } |
23 | // ``` | 23 | // ``` |
24 | pub(crate) fn unwrap_block(ctx: AssistCtx) -> Option<Assist> { | 24 | pub(crate) fn unwrap_block(ctx: AssistCtx) -> Option<Assist> { |
diff --git a/docs/user/assists.md b/docs/user/assists.md index 02323772c..a421aa0c3 100644 --- a/docs/user/assists.md +++ b/docs/user/assists.md | |||
@@ -698,7 +698,7 @@ use std::{collections::HashMap}; | |||
698 | 698 | ||
699 | ## `unwrap_block` | 699 | ## `unwrap_block` |
700 | 700 | ||
701 | Removes the `mut` keyword. | 701 | This assist removes if...else, for, while and loop control statements to just keep the body. |
702 | 702 | ||
703 | ```rust | 703 | ```rust |
704 | // BEFORE | 704 | // BEFORE |
@@ -710,6 +710,6 @@ fn foo() { | |||
710 | 710 | ||
711 | // AFTER | 711 | // AFTER |
712 | fn foo() { | 712 | fn foo() { |
713 | ┃println!("foo"); | 713 | println!("foo"); |
714 | } | 714 | } |
715 | ``` | 715 | ``` |