Skip to content

Commit 63bdb3a

Browse files
committed
improve formatting
1 parent 64856e2 commit 63bdb3a

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

compiler/rustc_mir/src/transform/check_unsafety.rs

+8-4
Original file line numberDiff line numberDiff line change
@@ -236,10 +236,14 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> {
236236
UnsafetyViolationDetails::DerefOfRawPointer,
237237
),
238238
ty::Adt(adt, _) if adt.is_union() => {
239-
let assign_to_field = context
240-
== PlaceContext::MutatingUse(MutatingUseContext::Store)
241-
|| context == PlaceContext::MutatingUse(MutatingUseContext::Drop)
242-
|| context == PlaceContext::MutatingUse(MutatingUseContext::AsmOutput);
239+
let assign_to_field = matches!(
240+
context,
241+
PlaceContext::MutatingUse(
242+
MutatingUseContext::Store
243+
| MutatingUseContext::Drop
244+
| MutatingUseContext::AsmOutput
245+
)
246+
);
243247
// If there is a `Deref` further along the projection chain, this is *not* an
244248
// assignment to a union field. In that case the union field is just read to
245249
// obtain the pointer/reference.

0 commit comments

Comments
 (0)