Fix new clippy::precedence errors
`clippy::precedence` now applies to bitwise `&` and `|`. Update with all of its suggestions, including a separate elided lifetime suggestion.
This commit is contained in:
parent
7065cd0420
commit
5d60d2a905
7 changed files with 13 additions and 13 deletions
|
|
@ -640,7 +640,7 @@ fn run() {
|
|||
fn something_with_a_dtor(f: &dyn Fn()) {
|
||||
struct A<'a>(&'a (dyn Fn() + 'a));
|
||||
|
||||
impl<'a> Drop for A<'a> {
|
||||
impl Drop for A<'_> {
|
||||
fn drop(&mut self) {
|
||||
(self.0)();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -143,9 +143,9 @@ where
|
|||
|
||||
// If the addition carried up, we need to right-shift the result and
|
||||
// adjust the exponent:
|
||||
if a_significand & implicit_bit << 4 != MinInt::ZERO {
|
||||
if a_significand & (implicit_bit << 4) != MinInt::ZERO {
|
||||
let sticky = F::Int::from_bool(a_significand & one != MinInt::ZERO);
|
||||
a_significand = a_significand >> 1 | sticky;
|
||||
a_significand = (a_significand >> 1) | sticky;
|
||||
a_exponent += 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -161,7 +161,7 @@ where
|
|||
let shift = (1 - a_exponent).cast();
|
||||
let sticky =
|
||||
F::Int::from_bool((a_significand << bits.wrapping_sub(shift).cast()) != MinInt::ZERO);
|
||||
a_significand = a_significand >> shift.cast() | sticky;
|
||||
a_significand = (a_significand >> shift.cast()) | sticky;
|
||||
a_exponent = 0;
|
||||
}
|
||||
|
||||
|
|
@ -170,7 +170,7 @@ where
|
|||
let round_guard_sticky: i32 = a_significand_i32 & 0x7;
|
||||
|
||||
// Shift the significand into place, and mask off the implicit bit.
|
||||
let mut result = a_significand >> 3 & significand_mask;
|
||||
let mut result = (a_significand >> 3) & significand_mask;
|
||||
|
||||
// Insert the exponent and sign.
|
||||
result |= a_exponent.cast() << significand_bits;
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ mod int_to_float {
|
|||
fn m_adj<F: Float>(m_base: F::Int, dropped_bits: F::Int) -> F::Int {
|
||||
// Branchlessly extract a `1` if rounding up should happen, 0 otherwise
|
||||
// This accounts for rounding to even.
|
||||
let adj = (dropped_bits - (dropped_bits >> (F::BITS - 1) & !m_base)) >> (F::BITS - 1);
|
||||
let adj = (dropped_bits - ((dropped_bits >> (F::BITS - 1)) & !m_base)) >> (F::BITS - 1);
|
||||
|
||||
// Add one when we need to round up. Break ties to even.
|
||||
m_base + adj
|
||||
|
|
@ -129,7 +129,7 @@ mod int_to_float {
|
|||
let m_base: u32 = (i_m >> shift_f_lt_i::<u64, f32>()) as u32;
|
||||
// The entire lower half of `i` will be truncated (masked portion), plus the
|
||||
// next `EXP_BITS` bits.
|
||||
let adj = (i_m >> f32::EXP_BITS | i_m & 0xFFFF) as u32;
|
||||
let adj = ((i_m >> f32::EXP_BITS) | i_m & 0xFFFF) as u32;
|
||||
let m = m_adj::<f32>(m_base, adj);
|
||||
let e = if i == 0 { 0 } else { exp::<u64, f32>(n) - 1 };
|
||||
repr::<f32>(e, m)
|
||||
|
|
@ -187,7 +187,7 @@ mod int_to_float {
|
|||
let m_base: u64 = (i_m >> shift_f_lt_i::<u128, f64>()) as u64;
|
||||
// The entire lower half of `i` will be truncated (masked portion), plus the
|
||||
// next `EXP_BITS` bits.
|
||||
let adj = (i_m >> f64::EXP_BITS | i_m & 0xFFFF_FFFF) as u64;
|
||||
let adj = ((i_m >> f64::EXP_BITS) | i_m & 0xFFFF_FFFF) as u64;
|
||||
let m = m_adj::<f64>(m_base, adj);
|
||||
let e = if i == 0 { 0 } else { exp::<u128, f64>(n) - 1 };
|
||||
repr::<f64>(e, m)
|
||||
|
|
@ -377,7 +377,7 @@ where
|
|||
};
|
||||
|
||||
// Set the implicit 1-bit.
|
||||
let m: I::UnsignedInt = I::UnsignedInt::ONE << (I::BITS - 1) | m_base;
|
||||
let m: I::UnsignedInt = (I::UnsignedInt::ONE << (I::BITS - 1)) | m_base;
|
||||
|
||||
// Shift based on the exponent and bias.
|
||||
let s: u32 = (foobar) - u32::cast_from(fbits >> F::SIG_BITS);
|
||||
|
|
|
|||
|
|
@ -261,7 +261,7 @@ where
|
|||
let c_hw = c_hw::<F>();
|
||||
|
||||
// Check that the top bit is set, i.e. value is within `[1, 2)`.
|
||||
debug_assert!(b_uq1_hw & one_hw << (HalfRep::<F>::BITS - 1) > zero_hw);
|
||||
debug_assert!(b_uq1_hw & (one_hw << (HalfRep::<F>::BITS - 1)) > zero_hw);
|
||||
|
||||
// b >= 1, thus an upper bound for 3/4 + 1/sqrt(2) - b/2 is about 0.9572,
|
||||
// so x0 fits to UQ0.HW without wrapping.
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ where
|
|||
// not all zero so that the result is correctly rounded below.
|
||||
let sticky = product_low << (bits - shift) != zero;
|
||||
product_low =
|
||||
product_high << (bits - shift) | product_low >> shift | (sticky as u32).cast();
|
||||
(product_high << (bits - shift)) | (product_low >> shift) | (sticky as u32).cast();
|
||||
product_high >>= shift;
|
||||
} else {
|
||||
// Result is normal before rounding; insert the exponent.
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ where
|
|||
} else {
|
||||
src_zero
|
||||
};
|
||||
let denormalized_significand: F::Int = significand >> shift | sticky;
|
||||
let denormalized_significand: F::Int = (significand >> shift) | sticky;
|
||||
abs_result = (denormalized_significand >> (F::SIG_BITS - R::SIG_BITS)).cast();
|
||||
let round_bits = denormalized_significand & round_mask;
|
||||
// Round to nearest
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ where
|
|||
let mut x = T::from(c);
|
||||
let mut i = 1;
|
||||
while i < mem::size_of::<T>() {
|
||||
x = x << 8 | T::from(c);
|
||||
x = (x << 8) | T::from(c);
|
||||
i += 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue