Skip to content

Commit be6381e

Browse files
committed
lower_pattern_unadjusted: cleanup Tuple(..) branch.
1 parent 3b0af1d commit be6381e

File tree

1 file changed

+12
-14
lines changed
  • src/librustc_mir/hair/pattern

1 file changed

+12
-14
lines changed

src/librustc_mir/hair/pattern/mod.rs

+12-14
Original file line numberDiff line numberDiff line change
@@ -557,21 +557,19 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
557557
}
558558

559559
hir::PatKind::Tuple(ref subpatterns, ddpos) => {
560-
match ty.kind {
561-
ty::Tuple(ref tys) => {
562-
let subpatterns =
563-
subpatterns.iter()
564-
.enumerate_and_adjust(tys.len(), ddpos)
565-
.map(|(i, subpattern)| FieldPat {
566-
field: Field::new(i),
567-
pattern: self.lower_pattern(subpattern)
568-
})
569-
.collect();
570-
571-
PatKind::Leaf { subpatterns }
572-
}
560+
let tys = match ty.kind {
561+
ty::Tuple(ref tys) => tys,
573562
_ => span_bug!(pat.span, "unexpected type for tuple pattern: {:?}", ty),
574-
}
563+
};
564+
let subpatterns = subpatterns
565+
.iter()
566+
.enumerate_and_adjust(tys.len(), ddpos)
567+
.map(|(i, subpattern)| FieldPat {
568+
field: Field::new(i),
569+
pattern: self.lower_pattern(subpattern)
570+
})
571+
.collect();
572+
PatKind::Leaf { subpatterns }
575573
}
576574

577575
hir::PatKind::Binding(_, id, ident, ref sub) => {

0 commit comments

Comments
 (0)