Skip to content

Commit 9c3a46e

Browse files
committed
refactor valtree type calculation code
1 parent 5026465 commit 9c3a46e

File tree

1 file changed

+9
-17
lines changed

1 file changed

+9
-17
lines changed

compiler/rustc_mir_build/src/builder/matches/match_pair.rs

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -157,23 +157,15 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
157157
elem_ty: Ty<'tcx>,
158158
) -> MatchPairTree<'pat, 'tcx> {
159159
let tcx = self.tcx;
160-
let (const_ty, pat_ty) = match src_pat_ty.kind() {
161-
ty::Slice(_) => (
162-
Ty::new_imm_ref(
163-
tcx,
164-
tcx.lifetimes.re_erased,
165-
Ty::new_array(tcx, elem_ty, subslice_len),
166-
),
167-
Ty::new_slice(tcx, elem_ty),
168-
),
169-
ty::Array(_, _) => (
170-
Ty::new_imm_ref(
171-
tcx,
172-
tcx.lifetimes.re_erased,
173-
Ty::new_array(tcx, elem_ty, subslice_len),
174-
),
175-
Ty::new_array(tcx, elem_ty, subslice_len),
176-
),
160+
let const_ty = Ty::new_imm_ref(
161+
tcx,
162+
tcx.lifetimes.re_erased,
163+
Ty::new_array(tcx, elem_ty, subslice_len),
164+
);
165+
166+
let pat_ty = match src_pat_ty.kind() {
167+
ty::Slice(_) => Ty::new_slice(tcx, elem_ty),
168+
ty::Array(_, _) => Ty::new_array(tcx, elem_ty, subslice_len),
177169
_ => unreachable!(),
178170
};
179171

0 commit comments

Comments
 (0)