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#####"
fn foo() {
<|>println!("foo");
println!("foo");
}
"#####,
)

View file

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

View 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");
}
```