Apply clippy fixes

This commit is contained in:
Riley Williams 2025-07-15 10:02:51 -04:00
parent 6b17767190
commit ab441e9425
6 changed files with 12 additions and 15 deletions

View File

@ -880,7 +880,7 @@ mod tests {
let a_item = a.next();
let b_item = b.next();
assert_eq!(a_item, b_item, "{}", i);
assert_eq!(a_item, b_item, "{i}");
i += 1;

View File

@ -1871,14 +1871,14 @@ mod tests {
assert_eq!(all.len(), MAP_SLOTS - 1);
let mut even = almost_filled_map();
even.retain(|_, &mut v| v % 2 == 0);
even.retain(|_, &mut v| v.is_multiple_of(2));
assert_eq!(even.len(), (MAP_SLOTS - 1) / 2);
for &v in even.values() {
assert_eq!(v % 2, 0);
}
let mut odd = almost_filled_map();
odd.retain(|_, &mut v| v % 2 != 0);
odd.retain(|_, &mut v| !v.is_multiple_of(2));
assert_eq!(odd.len(), MAP_SLOTS / 2);
for &v in odd.values() {
assert_ne!(v % 2, 0);

View File

@ -922,7 +922,7 @@ mod tests {
for _ in 0..1_000_000 {
let v = rb.dequeue().unwrap();
println!("{}", v);
println!("{v}");
rb.enqueue(v).unwrap();
assert_eq!(rb.len(), 2);
}

View File

@ -1016,7 +1016,7 @@ mod tests {
let s: String<8> = String::try_from("abcd").unwrap();
let mut std_s = std::string::String::new();
write!(std_s, "{:?}", s).unwrap();
write!(std_s, "{s:?}").unwrap();
assert_eq!("\"abcd\"", std_s);
}
@ -1026,7 +1026,7 @@ mod tests {
let s: String<8> = String::try_from("abcd").unwrap();
let mut std_s = std::string::String::new();
write!(std_s, "{}", s).unwrap();
write!(std_s, "{s}").unwrap();
assert_eq!("abcd", std_s);
}

View File

@ -1014,10 +1014,7 @@ impl<T, LenT: LenType, S: VecStorage<T> + ?Sized> VecInner<T, LenT, S> {
pub fn insert(&mut self, index: usize, element: T) -> Result<(), T> {
let len = self.len();
if index > len {
panic!(
"insertion index (is {}) should be <= len (is {})",
index, len
);
panic!("insertion index (is {index}) should be <= len (is {len})");
}
// check there's space for the new element
@ -1071,7 +1068,7 @@ impl<T, LenT: LenType, S: VecStorage<T> + ?Sized> VecInner<T, LenT, S> {
pub fn remove(&mut self, index: usize) -> T {
let len = self.len();
if index >= len {
panic!("removal index (is {}) should be < len (is {})", index, len);
panic!("removal index (is {index}) should be < len (is {len})");
}
unsafe {
// infallible

View File

@ -90,7 +90,7 @@ fn contention() {
while p.enqueue(i as u8).is_err() {}
}
println!("producer: {}", sum);
println!("producer: {sum}");
});
scope.spawn(move || {
@ -105,7 +105,7 @@ fn contention() {
}
}
println!("consumer: {}", sum);
println!("consumer: {sum}");
});
});
}
@ -132,7 +132,7 @@ fn mpmc_contention() {
for i in 0..(16 * N) {
sum = sum.wrapping_add(i);
println!("enqueue {}", i);
println!("enqueue {i}");
while Q.enqueue(i).is_err() {}
}
@ -147,7 +147,7 @@ fn mpmc_contention() {
loop {
if let Some(v) = Q.dequeue() {
sum = sum.wrapping_add(v);
println!("dequeue {}", v);
println!("dequeue {v}");
break;
}
}