@@ -606,16 +606,16 @@ match mypoint {
606606
607607In general, the field names of a struct do not have to appear in the same
608608order they appear in the type. When you are not interested in all
609- the fields of a struct, a struct pattern may end with ` , _ ` (as in
610- ` Name { field1, _ } ` ) to indicate that you're ignoring all other fields.
609+ the fields of a struct, a struct pattern may end with ` , .. ` (as in
610+ ` Name { field1, .. } ` ) to indicate that you're ignoring all other fields.
611611Additionally, struct fields have a shorthand matching form that simply
612612reuses the field name as the binding name.
613613
614614~~~
615615# struct Point { x: f64, y: f64 }
616616# let mypoint = Point { x: 0.0, y: 0.0 };
617617match mypoint {
618- Point { x, _ } => { println(x.to_str()) }
618+ Point { x, .. } => { println(x.to_str()) }
619619}
620620~~~
621621
@@ -696,7 +696,7 @@ fn area(sh: Shape) -> f64 {
696696~~~~
697697
698698You can write a lone ` _ ` to ignore an individual field, and can
699- ignore all fields of a variant like: ` Circle(* ) ` . As in their
699+ ignore all fields of a variant like: ` Circle(.. ) ` . As in their
700700introduction form, nullary enum patterns are written without
701701parentheses.
702702
@@ -725,7 +725,7 @@ enum Shape {
725725}
726726fn area(sh: Shape) -> f64 {
727727 match sh {
728- Circle { radius: radius, _ } => f64::consts::PI * square(radius),
728+ Circle { radius: radius, .. } => f64::consts::PI * square(radius),
729729 Rectangle { top_left: top_left, bottom_right: bottom_right } => {
730730 (bottom_right.x - top_left.x) * (top_left.y - bottom_right.y)
731731 }
@@ -1698,7 +1698,7 @@ a function that returns `Option<T>` instead of `T`.
16981698fn radius(shape: Shape) -> Option<f64> {
16991699 match shape {
17001700 Circle(_, radius) => Some(radius),
1701- Rectangle(* ) => None
1701+ Rectangle(.. ) => None
17021702 }
17031703}
17041704~~~~
0 commit comments