Skip to content

Commit 057f7a4

Browse files
committed
Update for review comments.
1 parent 43583f6 commit 057f7a4

File tree

3 files changed

+14
-17
lines changed

3 files changed

+14
-17
lines changed

src/expressions/if-expr.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ assert_eq!(y, "Bigger");
4444

4545
> **<sup>Syntax</sup>**\
4646
> _IfLetExpression_ :\
47-
> &nbsp;&nbsp; `if` `let` [_Patterns_] `=` [_Expression_]<sub>_except struct or lazy boolean operator expression_</sub>
47+
> &nbsp;&nbsp; `if` `let` [_MatchArmPatterns_] `=` [_Expression_]<sub>_except struct or lazy boolean operator expression_</sub>
4848
> [_BlockExpression_]\
4949
> &nbsp;&nbsp; (`else` (
5050
> [_BlockExpression_]
@@ -152,7 +152,7 @@ if let PAT = ( EXPR || EXPR ) { .. }
152152
[_BlockExpression_]: expressions/block-expr.html
153153
[_Expression_]: expressions.html
154154
[_LazyBooleanOperatorExpression_]: expressions/operator-expr.html#lazy-boolean-operators
155-
[_Patterns_]: expressions/match-expr.html
155+
[_MatchArmPatterns_]: expressions/match-expr.html
156156
[_eRFCIfLetChain_]: https://github.com/rust-lang/rfcs/blob/master/text/2497-if-let-chains.md#rollout-plan-and-transitioning-to-rust-2018
157157
[`match` expression]: expressions/match-expr.html
158158
[scrutinee]: glossary.html#scrutinee

src/expressions/loop-expr.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ while i < 10 {
6767

6868
> **<sup>Syntax</sup>**\
6969
> [_PredicatePatternLoopExpression_] :\
70-
> &nbsp;&nbsp; `while` `let` [_Patterns_] `=` [_Expression_]<sub>except struct expression</sub>
70+
> &nbsp;&nbsp; `while` `let` [_MatchArmPatterns_] `=` [_Expression_]<sub>except struct expression</sub>
7171
> [_BlockExpression_]
7272
7373
A `while let` loop is semantically similar to a `while` loop but in place of a
@@ -286,8 +286,8 @@ expression `()`.
286286
[LIFETIME_OR_LABEL]: tokens.html#lifetimes-and-loop-labels
287287
[_BlockExpression_]: expressions/block-expr.html
288288
[_Expression_]: expressions.html
289+
[_MatchArmPatterns_]: expressions/match-expr.html
289290
[_Pattern_]: patterns.html
290-
[_Patterns_]: expressions/match-expr.html
291291
[`match` expression]: expressions/match-expr.html
292292
[scrutinee]: glossary.html#scrutinee
293293
[temporary values]: expressions.html#temporary-lifetimes

src/expressions/match-expr.md

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
> &nbsp;&nbsp; _MatchArm_ `=>` ( [_BlockExpression_] | [_Expression_] ) `,`<sup>?</sup>
1616
>
1717
> _MatchArm_ :\
18-
> &nbsp;&nbsp; [_OuterAttribute_]<sup>\*</sup> _Patterns_ _MatchArmGuard_<sup>?</sup>
18+
> &nbsp;&nbsp; [_OuterAttribute_]<sup>\*</sup> _MatchArmPatterns_ _MatchArmGuard_<sup>?</sup>
1919
>
20-
> _Patterns_ :\
20+
> _MatchArmPatterns_ :\
2121
> &nbsp;&nbsp; `|`<sup>?</sup> [_Pattern_] ( `|` [_Pattern_] )<sup>\*</sup>
2222
>
2323
> _MatchArmGuard_ :\
@@ -76,9 +76,8 @@ let message = match x {
7676
assert_eq!(message, "a few");
7777
```
7878

79-
> Note: The `2..=9` is a [Range Pattern], not a [Range Expression] and, thus,
80-
> only those types of ranges supported by range patterns can be used in match
81-
> arms.
79+
> Note: The `2..=9` is a [Range Pattern], not a [Range Expression]. Thus, only
80+
> those types of ranges supported by range patterns can be used in match arms.
8281
8382
Every binding in each `|` separated pattern must appear in all of the patterns
8483
in the arm. Every binding of the same name must have the same type, and have
@@ -109,15 +108,13 @@ let message = match maybe_digit {
109108
> and side effects it has to execute multiple times. For example:
110109
>
111110
> ```rust
112-
> use std::cell::Cell;
113-
> fn main() {
114-
> let i : Cell<i32> = Cell::new(0);
115-
> match 1 {
116-
> 1 | _ if { i.set(i.get() + 1); false } => {}
117-
> _ => {}
118-
> }
119-
> assert_eq!(i.get(), 2);
111+
> # use std::cell::Cell;
112+
> let i : Cell<i32> = Cell::new(0);
113+
> match 1 {
114+
> 1 | _ if { i.set(i.get() + 1); false } => {}
115+
> _ => {}
120116
> }
117+
> assert_eq!(i.get(), 2);
121118
> ```
122119
123120
## Attributes on match arms

0 commit comments

Comments
 (0)