Skip to content

Commit 38787e4

Browse files
committed
Update for review.
1 parent 7a62830 commit 38787e4

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

src/expressions/if-expr.md

+5-7
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,10 @@ assert_eq!(y, "Bigger");
5353
5454
An `if let` expression is semantically similar to an `if` expression but in
5555
place of a condition expression it expects the keyword `let` followed by a
56-
pattern, an `=` and an expression. If the value of the expression on the right
57-
hand side of the `=` matches the pattern, the corresponding block will
58-
execute, otherwise flow proceeds to the following `else` block if it exists.
59-
Like `if` expressions, `if let` expressions have a value determined by the
60-
block that is evaluated.
56+
pattern, an `=` and a [scrutinee] expression. If the value of the scrutinee
57+
matches the pattern, the corresponding block will execute. Otherwise, flow
58+
proceeds to the following `else` block if it exists. Like `if` expressions,
59+
`if let` expressions have a value determined by the block that is evaluated.
6160

6261
```rust
6362
let dish = ("Ham", "Eggs");
@@ -75,8 +74,6 @@ if let ("Ham", b) = dish {
7574
println!("Ham is served with {}", b);
7675
}
7776

78-
// Irrefutable patterns are allowed primarily to make it easier for macros to
79-
// accept any kind of pattern.
8077
if let _ = 5 {
8178
println!("Irrefutable patterns are always true");
8279
}
@@ -142,3 +139,4 @@ if let PAT = ( EXPR || EXPR ) { .. }
142139
[_Pattern_]: patterns.html
143140
[_LazyBooleanOperatorExpression_]: expressions/operator-expr.html#lazy-boolean-operators
144141
[_eRFCIfLetChain_]: https://github.com/rust-lang/rfcs/blob/master/text/2497-if-let-chains.md#rollout-plan-and-transitioning-to-rust-2018
142+
[scrutinee]: glossary.html#scrutinee

src/expressions/loop-expr.md

+3-5
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ while i < 10 {
7373
A `while let` loop is semantically similar to a `while` loop but in place of a
7474
condition expression it expects the keyword `let` followed by a pattern, an
7575
`=`, a [scrutinee] expression and a block expression. If the value of the
76-
expression on the right hand side of the `=` matches the pattern, the loop
77-
body block executes then control returns to the pattern matching statement.
78-
Otherwise, the while expression completes.
76+
scrutinee matches the pattern, the loop body block executes then control
77+
returns to the pattern matching statement. Otherwise, the while expression
78+
completes.
7979

8080
```rust
8181
let mut x = vec![1, 2, 3];
@@ -84,8 +84,6 @@ while let Some(y) = x.pop() {
8484
println!("y = {}", y);
8585
}
8686

87-
// Irrefutable patterns are allowed primarily to make it easier for macros to
88-
// accept any kind of pattern.
8987
while let _ = 5 {
9088
println!("Irrefutable patterns are always true");
9189
break;

0 commit comments

Comments
 (0)