mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 05:23:24 +00:00
Add unwrap block assist #4156
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
This commit is contained in:
parent
76733f0cd4
commit
bbe22640b8
3 changed files with 5 additions and 5 deletions
|
@ -740,7 +740,7 @@ fn foo() {
|
||||||
"#####,
|
"#####,
|
||||||
r#####"
|
r#####"
|
||||||
fn foo() {
|
fn foo() {
|
||||||
<|>println!("foo");
|
println!("foo");
|
||||||
}
|
}
|
||||||
"#####,
|
"#####,
|
||||||
)
|
)
|
||||||
|
|
|
@ -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> {
|
||||||
|
|
|
@ -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");
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in a new issue