From 76733f0cd456005295e60da8c45d74c8c48f177c Mon Sep 17 00:00:00 2001 From: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com> Date: Wed, 29 Apr 2020 13:52:55 +0200 Subject: Add unwrap block assist #4156 Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com> --- docs/user/assists.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'docs/user') diff --git a/docs/user/assists.md b/docs/user/assists.md index 6c6943622..02323772c 100644 --- a/docs/user/assists.md +++ b/docs/user/assists.md @@ -695,3 +695,21 @@ use std::┃collections::HashMap; // AFTER use std::{collections::HashMap}; ``` + +## `unwrap_block` + +Removes the `mut` keyword. + +```rust +// BEFORE +fn foo() { + if true {┃ + println!("foo"); + } +} + +// AFTER +fn foo() { + ┃println!("foo"); +} +``` -- cgit v1.2.3 From bbe22640b8d52354c3de3e126c9fcda5b1b174fd Mon Sep 17 00:00:00 2001 From: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com> Date: Wed, 29 Apr 2020 14:53:47 +0200 Subject: Add unwrap block assist #4156 Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com> --- docs/user/assists.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs/user') diff --git a/docs/user/assists.md b/docs/user/assists.md index 02323772c..a421aa0c3 100644 --- a/docs/user/assists.md +++ b/docs/user/assists.md @@ -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"); } ``` -- cgit v1.2.3