diff --git a/library/core/src/num/int_macros.rs b/library/core/src/num/int_macros.rs index 5ef2558a5fe4..052e1a21b32c 100644 --- a/library/core/src/num/int_macros.rs +++ b/library/core/src/num/int_macros.rs @@ -608,8 +608,7 @@ pub const fn checked_mul(self, rhs: Self) -> Option { without modifying the original"] #[inline] pub const fn checked_div(self, rhs: Self) -> Option { - // Using `&` helps LLVM see that it is the same check made in division. - if unlikely!(rhs == 0 || ((self == Self::MIN) & (rhs == -1))) { + if unlikely!(rhs == 0 || ((self == Self::MIN) && (rhs == -1))) { None } else { // SAFETY: div by zero and by INT_MIN have been checked above @@ -662,8 +661,7 @@ pub const fn checked_div_euclid(self, rhs: Self) -> Option { without modifying the original"] #[inline] pub const fn checked_rem(self, rhs: Self) -> Option { - // Using `&` helps LLVM see that it is the same check made in division. - if unlikely!(rhs == 0 || ((self == Self::MIN) & (rhs == -1))) { + if unlikely!(rhs == 0 || ((self == Self::MIN) && (rhs == -1))) { None } else { // SAFETY: div by zero and by INT_MIN have been checked above diff --git a/library/core/src/num/uint_macros.rs b/library/core/src/num/uint_macros.rs index 507ff516a8f2..691d0891b144 100644 --- a/library/core/src/num/uint_macros.rs +++ b/library/core/src/num/uint_macros.rs @@ -1525,7 +1525,7 @@ pub const fn carrying_add(self, rhs: Self, carry: bool) -> (Self, bool) { // to generate optimal code for now, and LLVM doesn't have an equivalent intrinsic let (a, b) = self.overflowing_add(rhs); let (c, d) = a.overflowing_add(carry as $SelfT); - (c, b | d) + (c, b || d) } /// Calculates `self` + `rhs` with a signed `rhs` @@ -1606,7 +1606,7 @@ pub const fn borrowing_sub(self, rhs: Self, borrow: bool) -> (Self, bool) { // to generate optimal code for now, and LLVM doesn't have an equivalent intrinsic let (a, b) = self.overflowing_sub(rhs); let (c, d) = a.overflowing_sub(borrow as $SelfT); - (c, b | d) + (c, b || d) } /// Computes the absolute difference between `self` and `other`. diff --git a/library/core/src/str/validations.rs b/library/core/src/str/validations.rs index 093c9c37b60b..f2d1c7378088 100644 --- a/library/core/src/str/validations.rs +++ b/library/core/src/str/validations.rs @@ -210,7 +210,7 @@ macro_rules! next { // break if there is a nonascii byte let zu = contains_nonascii(*block); let zv = contains_nonascii(*block.offset(1)); - if zu | zv { + if zu || zv { break; } }