Update to latest clippy
This commit is contained in:
parent
32e52e8fdd
commit
90459e8173
@ -102,7 +102,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
|
||||
let ptr_layout = this.layout_of(ptr_ty)?;
|
||||
|
||||
for (i, ptr) in ptrs.into_iter().enumerate() {
|
||||
let offset = ptr_layout.size * i.try_into().unwrap();
|
||||
let offset = ptr_layout.size.checked_mul(i.try_into().unwrap(), this).unwrap();
|
||||
|
||||
let op_place = buf_place.offset(offset, ptr_layout, this)?;
|
||||
|
||||
|
@ -166,7 +166,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
|
||||
dependency_format.1.iter().enumerate().filter_map(|(num, &linkage)| {
|
||||
// We add 1 to the number because that's what rustc also does everywhere it
|
||||
// calls `CrateNum::new`...
|
||||
#[allow(clippy::integer_arithmetic)]
|
||||
#[allow(clippy::arithmetic_side_effects)]
|
||||
(linkage != Linkage::NotLinked).then_some(CrateNum::new(num + 1))
|
||||
}),
|
||||
) {
|
||||
@ -707,7 +707,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
|
||||
.position(|&c| c == val)
|
||||
{
|
||||
let idx = u64::try_from(idx).unwrap();
|
||||
#[allow(clippy::integer_arithmetic)] // idx < num, so this never wraps
|
||||
#[allow(clippy::arithmetic_side_effects)] // idx < num, so this never wraps
|
||||
let new_ptr = ptr.offset(Size::from_bytes(num - idx - 1), this)?;
|
||||
this.write_pointer(new_ptr, dest)?;
|
||||
} else {
|
||||
@ -916,10 +916,10 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
|
||||
let a = this.read_scalar(a)?.to_u64()?;
|
||||
let b = this.read_scalar(b)?.to_u64()?;
|
||||
|
||||
#[allow(clippy::integer_arithmetic)]
|
||||
#[allow(clippy::arithmetic_side_effects)]
|
||||
// adding two u64 and a u8 cannot wrap in a u128
|
||||
let wide_sum = u128::from(c_in) + u128::from(a) + u128::from(b);
|
||||
#[allow(clippy::integer_arithmetic)] // it's a u128, we can shift by 64
|
||||
#[allow(clippy::arithmetic_side_effects)] // it's a u128, we can shift by 64
|
||||
let (c_out, sum) = ((wide_sum >> 64).truncate::<u8>(), wide_sum.truncate::<u64>());
|
||||
|
||||
let c_out_field = this.place_field(dest, 0)?;
|
||||
|
@ -612,7 +612,7 @@ fn simd_bitmask_index(idx: u32, vec_len: u32, endianness: Endian) -> u32 {
|
||||
assert!(idx < vec_len);
|
||||
match endianness {
|
||||
Endian::Little => idx,
|
||||
#[allow(clippy::integer_arithmetic)] // idx < vec_len
|
||||
#[allow(clippy::arithmetic_side_effects)] // idx < vec_len
|
||||
Endian::Big => vec_len - 1 - idx, // reverse order of bits
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
#![warn(clippy::integer_arithmetic)]
|
||||
#![warn(clippy::arithmetic_side_effects)]
|
||||
|
||||
mod backtrace;
|
||||
#[cfg(target_os = "linux")]
|
||||
|
@ -108,7 +108,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
|
||||
Ok(0)
|
||||
}
|
||||
|
||||
#[allow(non_snake_case, clippy::integer_arithmetic)]
|
||||
#[allow(non_snake_case, clippy::arithmetic_side_effects)]
|
||||
fn GetSystemTimeAsFileTime(
|
||||
&mut self,
|
||||
LPFILETIME_op: &OpTy<'tcx, Provenance>,
|
||||
|
@ -56,7 +56,7 @@ impl<'tcx> Default for TlsData<'tcx> {
|
||||
impl<'tcx> TlsData<'tcx> {
|
||||
/// Generate a new TLS key with the given destructor.
|
||||
/// `max_size` determines the integer size the key has to fit in.
|
||||
#[allow(clippy::integer_arithmetic)]
|
||||
#[allow(clippy::arithmetic_side_effects)]
|
||||
pub fn create_tls_key(
|
||||
&mut self,
|
||||
dtor: Option<ty::Instance<'tcx>>,
|
||||
|
@ -458,7 +458,7 @@ pub struct DirHandler {
|
||||
}
|
||||
|
||||
impl DirHandler {
|
||||
#[allow(clippy::integer_arithmetic)]
|
||||
#[allow(clippy::arithmetic_side_effects)]
|
||||
fn insert_new(&mut self, read_dir: ReadDir) -> u64 {
|
||||
let id = self.next_id;
|
||||
self.next_id += 1;
|
||||
|
@ -247,7 +247,7 @@ pub fn futex<'tcx>(
|
||||
// before doing the syscall.
|
||||
this.atomic_fence(AtomicFenceOrd::SeqCst)?;
|
||||
let mut n = 0;
|
||||
#[allow(clippy::integer_arithmetic)]
|
||||
#[allow(clippy::arithmetic_side_effects)]
|
||||
for _ in 0..val {
|
||||
if let Some(thread) = this.futex_wake(addr_usize, bitset) {
|
||||
this.unblock_thread(thread);
|
||||
|
@ -219,7 +219,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
|
||||
.copied()
|
||||
.scan(Size::ZERO, |a, x| {
|
||||
let res = Some(*a);
|
||||
*a += x;
|
||||
*a = a.checked_add(x, this).unwrap();
|
||||
res
|
||||
})
|
||||
.collect();
|
||||
|
@ -62,7 +62,7 @@ impl Handle {
|
||||
let floor_log2 = variant_count.ilog2();
|
||||
|
||||
// we need to add one for non powers of two to compensate for the difference
|
||||
#[allow(clippy::integer_arithmetic)] // cannot overflow
|
||||
#[allow(clippy::arithmetic_side_effects)] // cannot overflow
|
||||
if variant_count.is_power_of_two() { floor_log2 } else { floor_log2 + 1 }
|
||||
}
|
||||
|
||||
@ -87,7 +87,7 @@ impl Handle {
|
||||
|
||||
// packs the data into the lower `data_size` bits
|
||||
// and packs the discriminant right above the data
|
||||
#[allow(clippy::integer_arithmetic)] // cannot overflow
|
||||
#[allow(clippy::arithmetic_side_effects)] // cannot overflow
|
||||
return discriminant << data_size | data;
|
||||
}
|
||||
|
||||
@ -106,11 +106,11 @@ impl Handle {
|
||||
let data_size = u32::BITS.checked_sub(disc_size).unwrap();
|
||||
|
||||
// the lower `data_size` bits of this mask are 1
|
||||
#[allow(clippy::integer_arithmetic)] // cannot overflow
|
||||
#[allow(clippy::arithmetic_side_effects)] // cannot overflow
|
||||
let data_mask = 2u32.pow(data_size) - 1;
|
||||
|
||||
// the discriminant is stored right above the lower `data_size` bits
|
||||
#[allow(clippy::integer_arithmetic)] // cannot overflow
|
||||
#[allow(clippy::arithmetic_side_effects)] // cannot overflow
|
||||
let discriminant = handle >> data_size;
|
||||
|
||||
// the data is stored in the lower `data_size` bits
|
||||
|
Loading…
x
Reference in New Issue
Block a user