Skip to content

Commit 3218476

Browse files
spastorinojieyouxu
authored andcommitted
Do not do if ! else, use unnegated cond and swap the branches instead
1 parent 37e7459 commit 3218476

File tree

1 file changed

+3
-3
lines changed
  • compiler/rustc_mir_build/src/builder

1 file changed

+3
-3
lines changed

compiler/rustc_mir_build/src/builder/misc.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
5656
pub(crate) fn consume_by_copy_or_move(&self, place: Place<'tcx>) -> Operand<'tcx> {
5757
let tcx = self.tcx;
5858
let ty = place.ty(&self.local_decls, tcx).ty;
59-
if !self.infcx.type_is_copy_modulo_regions(self.param_env, ty) {
60-
Operand::Move(place)
61-
} else {
59+
if self.infcx.type_is_copy_modulo_regions(self.param_env, ty) {
6260
Operand::Copy(place)
61+
} else {
62+
Operand::Move(place)
6363
}
6464
}
6565
}

0 commit comments

Comments
 (0)