improve formatting

This commit is contained in:
Ralf Jung 2020-10-26 19:35:01 +01:00
parent 64856e29c1
commit 63bdb3ac09

View File

@ -236,10 +236,14 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> {
UnsafetyViolationDetails::DerefOfRawPointer,
),
ty::Adt(adt, _) if adt.is_union() => {
let assign_to_field = context
== PlaceContext::MutatingUse(MutatingUseContext::Store)
|| context == PlaceContext::MutatingUse(MutatingUseContext::Drop)
|| context == PlaceContext::MutatingUse(MutatingUseContext::AsmOutput);
let assign_to_field = matches!(
context,
PlaceContext::MutatingUse(
MutatingUseContext::Store
| MutatingUseContext::Drop
| MutatingUseContext::AsmOutput
)
);
// If there is a `Deref` further along the projection chain, this is *not* an
// assignment to a union field. In that case the union field is just read to
// obtain the pointer/reference.