Skip to content

Commit e143fa2

Browse files
committed
nested-match mutability (proposed by the reviewer)
1 parent 5503190 commit e143fa2

File tree

1 file changed

+4
-6
lines changed
  • compiler/rustc_ast_lowering/src

1 file changed

+4
-6
lines changed

compiler/rustc_ast_lowering/src/lib.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -1781,12 +1781,10 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
17811781
// Given we are only considering `ImplicitSelf` types, we needn't consider
17821782
// the case where we have a mutable pattern to a reference as that would
17831783
// no longer be an `ImplicitSelf`.
1784-
TyKind::Rptr(_, mt) if mt.ty.kind.is_implicit_self() && mt.mutbl.is_mut() => {
1785-
hir::ImplicitSelfKind::MutRef
1786-
}
1787-
TyKind::Rptr(_, mt) if mt.ty.kind.is_implicit_self() => {
1788-
hir::ImplicitSelfKind::ImmRef
1789-
}
1784+
TyKind::Rptr(_, mt) if mt.ty.kind.is_implicit_self() => match mt.mutbl {
1785+
hir::Mutability::Not => hir::ImplicitSelfKind::ImmRef,
1786+
hir::Mutability::Mut => hir::ImplicitSelfKind::MutRef,
1787+
},
17901788
_ => hir::ImplicitSelfKind::None,
17911789
}
17921790
}),

0 commit comments

Comments
 (0)