about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSantiago Pastorino <spastorino@gmail.com>2024-12-11 18:01:19 -0300
committer许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com>2024-12-18 18:57:33 +0800
commit3218476c1283af9510b284fb6e0ffad72da278cd (patch)
treef87fea22c54b4db0b90f26648bdf55b30939eb2c
parent37e74596c0b59e81b9ac58657f92297ef4ccb7ef (diff)
downloadrust-3218476c1283af9510b284fb6e0ffad72da278cd.tar.gz
rust-3218476c1283af9510b284fb6e0ffad72da278cd.zip
Do not do if ! else, use unnegated cond and swap the branches instead
-rw-r--r--compiler/rustc_mir_build/src/builder/misc.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_mir_build/src/builder/misc.rs b/compiler/rustc_mir_build/src/builder/misc.rs
index a53ae05e84f..9ea56a9574f 100644
--- a/compiler/rustc_mir_build/src/builder/misc.rs
+++ b/compiler/rustc_mir_build/src/builder/misc.rs
@@ -56,10 +56,10 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
     pub(crate) fn consume_by_copy_or_move(&self, place: Place<'tcx>) -> Operand<'tcx> {
         let tcx = self.tcx;
         let ty = place.ty(&self.local_decls, tcx).ty;
-        if !self.infcx.type_is_copy_modulo_regions(self.param_env, ty) {
-            Operand::Move(place)
-        } else {
+        if self.infcx.type_is_copy_modulo_regions(self.param_env, ty) {
             Operand::Copy(place)
+        } else {
+            Operand::Move(place)
         }
     }
 }