diff options
| author | Santiago 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 |
| commit | 3218476c1283af9510b284fb6e0ffad72da278cd (patch) | |
| tree | f87fea22c54b4db0b90f26648bdf55b30939eb2c | |
| parent | 37e74596c0b59e81b9ac58657f92297ef4ccb7ef (diff) | |
| download | rust-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.rs | 6 |
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) } } } |
