about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2020-10-26 19:35:01 +0100
committerRalf Jung <post@ralfj.de>2020-11-20 10:58:31 +0100
commit63bdb3ac0948683fe7548680d3b78bb5d8b32076 (patch)
treea142c5b871db3baa9e76f9f991eb5478d994d7a2
parent64856e29c1c780117348c196e05902476251bc92 (diff)
downloadrust-63bdb3ac0948683fe7548680d3b78bb5d8b32076.tar.gz
rust-63bdb3ac0948683fe7548680d3b78bb5d8b32076.zip
improve formatting
-rw-r--r--compiler/rustc_mir/src/transform/check_unsafety.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/compiler/rustc_mir/src/transform/check_unsafety.rs b/compiler/rustc_mir/src/transform/check_unsafety.rs
index e78f8d4c901..e90d5149c2f 100644
--- a/compiler/rustc_mir/src/transform/check_unsafety.rs
+++ b/compiler/rustc_mir/src/transform/check_unsafety.rs
@@ -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.