Skip to content

Commit ab441e9

Browse files
Apply clippy fixes
1 parent 6b17767 commit ab441e9

File tree

6 files changed

+12
-15
lines changed

6 files changed

+12
-15
lines changed

src/history_buf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -880,7 +880,7 @@ mod tests {
880880
let a_item = a.next();
881881
let b_item = b.next();
882882

883-
assert_eq!(a_item, b_item, "{}", i);
883+
assert_eq!(a_item, b_item, "{i}");
884884

885885
i += 1;
886886

src/index_map.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1871,14 +1871,14 @@ mod tests {
18711871
assert_eq!(all.len(), MAP_SLOTS - 1);
18721872

18731873
let mut even = almost_filled_map();
1874-
even.retain(|_, &mut v| v % 2 == 0);
1874+
even.retain(|_, &mut v| v.is_multiple_of(2));
18751875
assert_eq!(even.len(), (MAP_SLOTS - 1) / 2);
18761876
for &v in even.values() {
18771877
assert_eq!(v % 2, 0);
18781878
}
18791879

18801880
let mut odd = almost_filled_map();
1881-
odd.retain(|_, &mut v| v % 2 != 0);
1881+
odd.retain(|_, &mut v| !v.is_multiple_of(2));
18821882
assert_eq!(odd.len(), MAP_SLOTS / 2);
18831883
for &v in odd.values() {
18841884
assert_ne!(v % 2, 0);

src/spsc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -922,7 +922,7 @@ mod tests {
922922

923923
for _ in 0..1_000_000 {
924924
let v = rb.dequeue().unwrap();
925-
println!("{}", v);
925+
println!("{v}");
926926
rb.enqueue(v).unwrap();
927927
assert_eq!(rb.len(), 2);
928928
}

src/string/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,7 +1016,7 @@ mod tests {
10161016

10171017
let s: String<8> = String::try_from("abcd").unwrap();
10181018
let mut std_s = std::string::String::new();
1019-
write!(std_s, "{:?}", s).unwrap();
1019+
write!(std_s, "{s:?}").unwrap();
10201020
assert_eq!("\"abcd\"", std_s);
10211021
}
10221022

@@ -1026,7 +1026,7 @@ mod tests {
10261026

10271027
let s: String<8> = String::try_from("abcd").unwrap();
10281028
let mut std_s = std::string::String::new();
1029-
write!(std_s, "{}", s).unwrap();
1029+
write!(std_s, "{s}").unwrap();
10301030
assert_eq!("abcd", std_s);
10311031
}
10321032

src/vec/mod.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,10 +1014,7 @@ impl<T, LenT: LenType, S: VecStorage<T> + ?Sized> VecInner<T, LenT, S> {
10141014
pub fn insert(&mut self, index: usize, element: T) -> Result<(), T> {
10151015
let len = self.len();
10161016
if index > len {
1017-
panic!(
1018-
"insertion index (is {}) should be <= len (is {})",
1019-
index, len
1020-
);
1017+
panic!("insertion index (is {index}) should be <= len (is {len})");
10211018
}
10221019

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

tests/tsan.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ fn contention() {
9090
while p.enqueue(i as u8).is_err() {}
9191
}
9292

93-
println!("producer: {}", sum);
93+
println!("producer: {sum}");
9494
});
9595

9696
scope.spawn(move || {
@@ -105,7 +105,7 @@ fn contention() {
105105
}
106106
}
107107

108-
println!("consumer: {}", sum);
108+
println!("consumer: {sum}");
109109
});
110110
});
111111
}
@@ -132,7 +132,7 @@ fn mpmc_contention() {
132132

133133
for i in 0..(16 * N) {
134134
sum = sum.wrapping_add(i);
135-
println!("enqueue {}", i);
135+
println!("enqueue {i}");
136136
while Q.enqueue(i).is_err() {}
137137
}
138138

@@ -147,7 +147,7 @@ fn mpmc_contention() {
147147
loop {
148148
if let Some(v) = Q.dequeue() {
149149
sum = sum.wrapping_add(v);
150-
println!("dequeue {}", v);
150+
println!("dequeue {v}");
151151
break;
152152
}
153153
}

0 commit comments

Comments
 (0)