nested-match mutability (proposed by the reviewer)

This commit is contained in:
Maybe Waffle 2022-11-24 18:13:30 +00:00
parent 550319059d
commit e143fa2156

View File

@ -1781,12 +1781,10 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
// Given we are only considering `ImplicitSelf` types, we needn't consider // Given we are only considering `ImplicitSelf` types, we needn't consider
// the case where we have a mutable pattern to a reference as that would // the case where we have a mutable pattern to a reference as that would
// no longer be an `ImplicitSelf`. // no longer be an `ImplicitSelf`.
TyKind::Rptr(_, mt) if mt.ty.kind.is_implicit_self() && mt.mutbl.is_mut() => { TyKind::Rptr(_, mt) if mt.ty.kind.is_implicit_self() => match mt.mutbl {
hir::ImplicitSelfKind::MutRef hir::Mutability::Not => hir::ImplicitSelfKind::ImmRef,
} hir::Mutability::Mut => hir::ImplicitSelfKind::MutRef,
TyKind::Rptr(_, mt) if mt.ty.kind.is_implicit_self() => { },
hir::ImplicitSelfKind::ImmRef
}
_ => hir::ImplicitSelfKind::None, _ => hir::ImplicitSelfKind::None,
} }
}), }),