File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -114,6 +114,22 @@ match EXPR {
114
114
The expression cannot be a [ lazy boolean operator expression] [ _LazyBooleanOperatorExpression_ ] .
115
115
Use of a lazy boolean operator is ambiguous with a planned feature change
116
116
of the language (the implementation of if-let chains - see [ eRFC 2947] [ _eRFCIfLetChain_ ] ).
117
+ When lazy boolean operator expression is desired, this can be achieved
118
+ by using parenthesis as below:
119
+
120
+ ``` rust,ignore
121
+ // Before...
122
+ if let PAT = EXPR && EXPR { .. }
123
+
124
+ // After...
125
+ if let PAT = ( EXPR && EXPR ) { .. }
126
+
127
+ // Before...
128
+ if let PAT = EXPR || EXPR { .. }
129
+
130
+ // After...
131
+ if let PAT = ( EXPR || EXPR ) { .. }
132
+ ```
117
133
118
134
[ _Expression_ ] : expressions.html
119
135
[ _BlockExpression_ ] : expressions/block-expr.html
You can’t perform that action at this time.
0 commit comments