File tree 1 file changed +0
-10
lines changed 1 file changed +0
-10
lines changed Original file line number Diff line number Diff line change @@ -3200,16 +3200,6 @@ let z = match x { &0 => "zero", _ => "some" };
3200
3200
assert_eq!(y, z);
3201
3201
```
3202
3202
3203
- A pattern that's just an identifier, like ` Nil ` in the previous example, could
3204
- either refer to an enum variant that's in scope, or bind a new variable. The
3205
- compiler resolves this ambiguity by forbidding variable bindings that occur in
3206
- ` match ` patterns from shadowing names of variants that are in scope. For
3207
- example, wherever ` List ` is in scope, a ` match ` pattern would not be able to
3208
- bind ` Nil ` as a new name. The compiler interprets a variable pattern ` x ` as a
3209
- binding _ only_ if there is no variant named ` x ` in scope. A convention you can
3210
- use to avoid conflicts is simply to name variants with upper-case letters, and
3211
- local variables with lower-case letters.
3212
-
3213
3203
Multiple match patterns may be joined with the ` | ` operator. A range of values
3214
3204
may be specified with ` ... ` . For example:
3215
3205
You can’t perform that action at this time.
0 commit comments