Skip to content

Commit 9b0be01

Browse files
committed
fixed if let guards documentation
1 parent 3b3b8f6 commit 9b0be01

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/expressions/match-expr.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ When the pattern matches successfully, the `if let` expression in the guard is e
171171
* Otherwise, the next arm is tested.
172172

173173
```rust
174-
#![feature(if_let_guard)]
175174
let value = Some(10);
176175

177176
let msg = match value {
@@ -195,7 +194,7 @@ match opt {
195194
println!("x = {}, y = {}", x, y);
196195
}
197196
_ => {
198-
// `y` is not available here it was only bound inside the guard above.
197+
// `y` is not available here --- it was only bound inside the guard above.
199198
// Uncommenting the line below will cause a compile-time error:
200199
// println!("{}", y); // error: cannot find value `y` in this scope
201200
}
@@ -229,7 +228,7 @@ Before a guard (including an `if let` guard) is evaluated:
229228
};
230229

231230
```
232-
In the above example, `v` is already bound in the outer pattern, and the guard attempts to move it this is not allowed. You can fix it by cloning or borrowing:
231+
In the above example, `v` is already bound in the outer pattern, and the guard attempts to move it --- this is not allowed. You can fix it by cloning or borrowing:
233232
```rust
234233
Some(v) if let Some(_) = take(v.clone()) => "ok",
235234
```

0 commit comments

Comments
 (0)