aboutsummaryrefslogtreecommitdiff
path: root/docs/user
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-03-27 11:12:17 +0000
committerAleksey Kladov <[email protected]>2020-03-27 11:15:46 +0000
commit91e482b46d43a24cd0a48ea1119b93105140cff2 (patch)
tree3fd91a247ca1a9297884139d135aca4763d02da8 /docs/user
parentcbb53cf55ca350bbcada5fc759b0119d932e879d (diff)
Replace if with if-let
Diffstat (limited to 'docs/user')
-rw-r--r--docs/user/assists.md23
1 files changed, 23 insertions, 0 deletions
diff --git a/docs/user/assists.md b/docs/user/assists.md
index f3ce6b0e0..3b7467a26 100644
--- a/docs/user/assists.md
+++ b/docs/user/assists.md
@@ -583,6 +583,29 @@ fn handle(action: Action) {
583} 583}
584``` 584```
585 585
586## `replace_let_with_if_let`
587
588Replaces `if let` with an else branch with a `match` expression.
589
590```rust
591// BEFORE
592
593fn main(action: Action) {
594 ┃let x = compute();
595}
596
597fn compute() -> Option<i32> { None }
598
599// AFTER
600
601fn main(action: Action) {
602 if let Some(x) = compute() {
603 }
604}
605
606fn compute() -> Option<i32> { None }
607```
608
586## `replace_qualified_name_with_use` 609## `replace_qualified_name_with_use`
587 610
588Adds a use statement for a given fully-qualified name. 611Adds a use statement for a given fully-qualified name.