Skip to content

Apply clippy fixes #585

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Fixed

- CI now uses flags specified in `Cargo.toml` for `rustdoc` tests.
- Fixed clippy lints.

### Removed

Expand Down
2 changes: 1 addition & 1 deletion src/history_buf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions src/index_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/spsc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions src/string/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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);
}

Expand Down
7 changes: 2 additions & 5 deletions src/vec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions tests/tsan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ fn contention() {
while p.enqueue(i as u8).is_err() {}
}

println!("producer: {}", sum);
println!("producer: {sum}");
});

scope.spawn(move || {
Expand All @@ -105,7 +105,7 @@ fn contention() {
}
}

println!("consumer: {}", sum);
println!("consumer: {sum}");
});
});
}
Expand All @@ -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() {}
}

Expand All @@ -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;
}
}
Expand Down