Skip to content

Commit eb020bc

Browse files
committed
lower_pattern_unadjusted: simplify Binding(..) branch.
Avoid calling `.node_type(...)` again.
1 parent be6381e commit eb020bc

File tree

1 file changed

+2
-2
lines changed
  • src/librustc_mir/hair/pattern

1 file changed

+2
-2
lines changed

src/librustc_mir/hair/pattern/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,6 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
573573
}
574574

575575
hir::PatKind::Binding(_, id, ident, ref sub) => {
576-
let var_ty = self.tables.node_type(pat.hir_id);
577576
let bm = *self.tables.pat_binding_modes().get(pat.hir_id)
578577
.expect("missing binding mode");
579578
let (mutability, mode) = match bm {
@@ -591,13 +590,14 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
591590

592591
// A ref x pattern is the same node used for x, and as such it has
593592
// x's type, which is &T, where we want T (the type being matched).
593+
let var_ty = ty;
594594
if let ty::BindByReference(_) = bm {
595595
if let ty::Ref(_, rty, _) = ty.kind {
596596
ty = rty;
597597
} else {
598598
bug!("`ref {}` has wrong type {}", ident, ty);
599599
}
600-
}
600+
};
601601

602602
PatKind::Binding {
603603
mutability,

0 commit comments

Comments
 (0)