mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 15:54:15 +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
@ -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 New Issue
Block a user