Skip to content

Commit

Permalink
Do not do if ! else, use unnegated cond and swap the branches instead
Browse files Browse the repository at this point in the history
  • Loading branch information
spastorino authored and jieyouxu committed Dec 18, 2024
1 parent 37e7459 commit 3218476
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions compiler/rustc_mir_build/src/builder/misc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}

0 comments on commit 3218476

Please sign in to comment.