Skip to content

Commit

Permalink
add feature doc
Browse files Browse the repository at this point in the history
  • Loading branch information
unrealhoang committed May 16, 2019
1 parent d9d8b8e commit a3fa698
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions docs/user/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -390,14 +390,14 @@ fn foo() {

- Move guard expression to match arm body
```rust
//before:
// before:
fn f() {
match x {
<|>y @ 4 | y @ 5 if y > 5 => true,
_ => false
}
}
//after:
// after:
fn f() {
match x {
y @ 4 | y @ 5 => if y > 5 { <|>true },
Expand All @@ -406,6 +406,35 @@ fn f() {
}
```

- Move if condition to match arm guard
```rust
// before:
fn f() {
let mut t = 'a';
let chars = "abcd";
match t {
'\r' => if let Some(_) = chars.clone().next() {
t = 'e';<|>
false
},
_ => true
}
}

// after:
fn f() {
let mut t = 'a';
let chars = "abcd";
match t {
'\r' <|>if let Some(_) = chars.clone().next() => {
t = 'e';
false
},
_ => true
}
}
```

### Magic Completions

In addition to usual reference completion, rust-analyzer provides some ✨magic✨
Expand Down

0 comments on commit a3fa698

Please sign in to comment.