File tree Expand file tree Collapse file tree 1 file changed +9
-14
lines changed
src/librustc_mir/hair/pattern Expand file tree Collapse file tree 1 file changed +9
-14
lines changed Original file line number Diff line number Diff line change @@ -1154,24 +1154,19 @@ impl<'tcx> Constructor<'tcx> {
1154
1154
let pat = match * self {
1155
1155
Single | Variant ( _) => match ty. kind {
1156
1156
ty:: Adt ( ..) | ty:: Tuple ( ..) => {
1157
- let pats = pats
1157
+ let subpatterns = pats
1158
1158
. enumerate ( )
1159
1159
. map ( |( i, p) | FieldPat { field : Field :: new ( i) , pattern : p } )
1160
1160
. collect ( ) ;
1161
1161
1162
- if let ty:: Adt ( adt, substs) = ty. kind {
1163
- if adt. is_enum ( ) {
1164
- PatKind :: Variant {
1165
- adt_def : adt,
1166
- substs,
1167
- variant_index : self . variant_index_for_adt ( cx, adt) ,
1168
- subpatterns : pats,
1169
- }
1170
- } else {
1171
- PatKind :: Leaf { subpatterns : pats }
1172
- }
1173
- } else {
1174
- PatKind :: Leaf { subpatterns : pats }
1162
+ match ty. kind {
1163
+ ty:: Adt ( adt_def, substs) if adt_def. is_enum ( ) => PatKind :: Variant {
1164
+ adt_def,
1165
+ substs,
1166
+ variant_index : self . variant_index_for_adt ( cx, adt_def) ,
1167
+ subpatterns,
1168
+ } ,
1169
+ _ => PatKind :: Leaf { subpatterns } ,
1175
1170
}
1176
1171
}
1177
1172
ty:: Ref ( ..) => PatKind :: Deref { subpattern : pats. nth ( 0 ) . unwrap ( ) } ,
You can’t perform that action at this time.
0 commit comments