Add unwrap block assist #4156

Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
This commit is contained in:
Benjamin Coenen 2020-04-29 14:53:47 +02:00
parent 76733f0cd4
commit bbe22640b8
3 changed files with 5 additions and 5 deletions

View file

@ -740,7 +740,7 @@ fn foo() {
"#####, "#####,
r#####" r#####"
fn foo() { fn foo() {
<|>println!("foo"); println!("foo");
} }
"#####, "#####,
) )

View file

@ -6,7 +6,7 @@ use ra_syntax::{ast, AstNode};
// Assist: unwrap_block // 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() { // fn foo() {
@ -18,7 +18,7 @@ use ra_syntax::{ast, AstNode};
// -> // ->
// ``` // ```
// fn foo() { // fn foo() {
// <|>println!("foo"); // println!("foo");
// } // }
// ``` // ```
pub(crate) fn unwrap_block(ctx: AssistCtx) -> Option<Assist> { pub(crate) fn unwrap_block(ctx: AssistCtx) -> Option<Assist> {

View file

@ -698,7 +698,7 @@ use std::{collections::HashMap};
## `unwrap_block` ## `unwrap_block`
Removes the `mut` keyword. This assist removes if...else, for, while and loop control statements to just keep the body.
```rust ```rust
// BEFORE // BEFORE
@ -710,6 +710,6 @@ fn foo() {
// AFTER // AFTER
fn foo() { fn foo() {
println!("foo"); println!("foo");
} }
``` ```