diff --git a/library/core/src/num/int_macros.rs b/library/core/src/num/int_macros.rs index 5ef2558a5fe4b..052e1a21b32cb 100644 --- a/library/core/src/num/int_macros.rs +++ b/library/core/src/num/int_macros.rs @@ -608,8 +608,7 @@ macro_rules! int_impl { 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 @@ macro_rules! int_impl { 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 507ff516a8f28..691d0891b1448 100644 --- a/library/core/src/num/uint_macros.rs +++ b/library/core/src/num/uint_macros.rs @@ -1525,7 +1525,7 @@ macro_rules! uint_impl { // 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 @@ macro_rules! uint_impl { // 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 093c9c37b60b4..f2d1c73780880 100644 --- a/library/core/src/str/validations.rs +++ b/library/core/src/str/validations.rs @@ -210,7 +210,7 @@ pub(super) fn run_utf8_validation(v: &[u8]) -> Result<(), Utf8Error> { // 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; } }