mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-25 20:43:21 +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#####"
|
||||
fn foo() {
|
||||
<|>println!("foo");
|
||||
println!("foo");
|
||||
}
|
||||
"#####,
|
||||
)
|
||||
|
|
|
@ -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> {
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
```
|
||||
|
|
Loading…
Reference in a new issue