Skip to content

Commit 532060a

Browse files
committed
Remove duplicated explanation about lazy boolean operators in while let,
refer to the if let page instead.
1 parent 71b0551 commit 532060a

File tree

1 file changed

+3
-20
lines changed

1 file changed

+3
-20
lines changed

src/expressions/loop-expr.md

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -123,26 +123,7 @@ while let Some(v @ 1) | Some(v @ 2) = vals.pop() {
123123
}
124124
```
125125

126-
The expression cannot be a [lazy boolean operator expression][_LazyBooleanOperatorExpression_].
127-
Use of a lazy boolean operator is ambiguous with a planned feature change
128-
of the language (the implementation of if-let chains - see [eRFC 2947][_eRFCIfLetChain_]).
129-
When lazy boolean operator expression is desired, this can be achieved
130-
by using parenthesis as below:
131-
132-
<!-- ignore: psuedo code -->
133-
```rust,ignore
134-
// Before...
135-
while let PAT = EXPR && EXPR { .. }
136-
137-
// After...
138-
while let PAT = ( EXPR && EXPR ) { .. }
139-
140-
// Before...
141-
while let PAT = EXPR || EXPR { .. }
142-
143-
// After...
144-
while let PAT = ( EXPR || EXPR ) { .. }
145-
```
126+
As is the case in [`if let` expressions], the scrutinee cannot be a [lazy boolean operator expression][_LazyBooleanOperatorExpression_].
146127

147128
## Iterator loops
148129

@@ -315,3 +296,5 @@ expression `()`.
315296
[`match` expression]: match-expr.md
316297
[scrutinee]: ../glossary.md#scrutinee
317298
[temporary values]: ../expressions.md#temporary-lifetimes
299+
[_LazyBooleanOperatorExpression_]: operator-expr.md#lazy-boolean-operators
300+
[`if let` expressions]: if-expr.md#if-let-expressions

0 commit comments

Comments
 (0)