]> git.lizzy.rs Git - rust.git/commitdiff
Add unwrap block assist #4156
authorBenjamin Coenen <5719034+bnjjj@users.noreply.github.com>
Wed, 29 Apr 2020 12:53:47 +0000 (14:53 +0200)
committerBenjamin Coenen <5719034+bnjjj@users.noreply.github.com>
Wed, 29 Apr 2020 12:53:47 +0000 (14:53 +0200)
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
crates/ra_assists/src/doc_tests/generated.rs
crates/ra_assists/src/handlers/unwrap_block.rs
docs/user/assists.md

index 6fe95da6abefde24c2d51a68f9e40a36008bcda5..b53b97e89a5928c8f475ab8a19a028de7921c0f8 100644 (file)
@@ -740,7 +740,7 @@ fn foo() {
 "#####,
         r#####"
 fn foo() {
-    <|>println!("foo");
+    println!("foo");
 }
 "#####,
     )
index b98601f1c0815ea4b7ad7cedd579d023014e05fb..35d87bc9e77ef600a3b80d9e99509c198095a9f8 100644 (file)
@@ -6,7 +6,7 @@
 
 // Assist: unwrap_block
 //
-// Removes the `mut` keyword.
+// This assist removes if...else, for, while and loop control statements to just keep the body.
 //
 // ```
 // fn foo() {
@@ -18,7 +18,7 @@
 // ->
 // ```
 // fn foo() {
-//     <|>println!("foo");
+//     println!("foo");
 // }
 // ```
 pub(crate) fn unwrap_block(ctx: AssistCtx) -> Option<Assist> {
index 02323772c0d8920b37f321cf063b2d28ba9dab1a..a421aa0c3c8883417066bfbc2f17347f05f15e23 100644 (file)
@@ -698,7 +698,7 @@ use std::{collections::HashMap};
 
 ## `unwrap_block`
 
-Removes the `mut` keyword.
+This assist removes if...else, for, while and loop control statements to just keep the body.
 
 ```rust
 // BEFORE
@@ -710,6 +710,6 @@ fn foo() {
 
 // AFTER
 fn foo() {
-    println!("foo");
+    println!("foo");
 }
 ```