File tree Expand file tree Collapse file tree 1 file changed +0
-10
lines changed Expand file tree Collapse file tree 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" };
32003200assert_eq!(y, z);
32013201```
32023202
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-
32133203Multiple match patterns may be joined with the ` | ` operator. A range of values
32143204may be specified with ` ... ` . For example:
32153205
You can’t perform that action at this time.
0 commit comments