lower_pattern_unadjusted
: simplify Binding(..)
branch.
Avoid calling `.node_type(...)` again.
This commit is contained in:
parent
be6381e9e0
commit
eb020bc245
1 changed files with 2 additions and 2 deletions
|
@ -573,7 +573,6 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
hir::PatKind::Binding(_, id, ident, ref sub) => {
|
hir::PatKind::Binding(_, id, ident, ref sub) => {
|
||||||
let var_ty = self.tables.node_type(pat.hir_id);
|
|
||||||
let bm = *self.tables.pat_binding_modes().get(pat.hir_id)
|
let bm = *self.tables.pat_binding_modes().get(pat.hir_id)
|
||||||
.expect("missing binding mode");
|
.expect("missing binding mode");
|
||||||
let (mutability, mode) = match bm {
|
let (mutability, mode) = match bm {
|
||||||
|
@ -591,13 +590,14 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
|
||||||
|
|
||||||
// A ref x pattern is the same node used for x, and as such it has
|
// A ref x pattern is the same node used for x, and as such it has
|
||||||
// x's type, which is &T, where we want T (the type being matched).
|
// x's type, which is &T, where we want T (the type being matched).
|
||||||
|
let var_ty = ty;
|
||||||
if let ty::BindByReference(_) = bm {
|
if let ty::BindByReference(_) = bm {
|
||||||
if let ty::Ref(_, rty, _) = ty.kind {
|
if let ty::Ref(_, rty, _) = ty.kind {
|
||||||
ty = rty;
|
ty = rty;
|
||||||
} else {
|
} else {
|
||||||
bug!("`ref {}` has wrong type {}", ident, ty);
|
bug!("`ref {}` has wrong type {}", ident, ty);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
PatKind::Binding {
|
PatKind::Binding {
|
||||||
mutability,
|
mutability,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue