Skip to content

Commit 2d13768

Browse files
authored
ci: fix clippy test (#2686)
1 parent 88ce3f3 commit 2d13768

File tree

28 files changed

+54
-107
lines changed

28 files changed

+54
-107
lines changed

dc/s2n-quic-dc/src/path/secret/map/state/tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,12 +192,12 @@ impl Model {
192192
match invariant {
193193
Invariant::ContainsIp(ip) => {
194194
if state.max_capacity != 5 {
195-
assert!(state.peers.contains_key(ip), "{:?}", ip);
195+
assert!(state.peers.contains_key(ip), "{ip:?}");
196196
}
197197
}
198198
Invariant::ContainsId(id) => {
199199
if state.max_capacity != 5 {
200-
assert!(state.ids.contains_key(id), "{:?}", id);
200+
assert!(state.ids.contains_key(id), "{id:?}");
201201
}
202202
}
203203
Invariant::IdRemoved(id) => {

dc/s2n-quic-dc/src/stream/client/rpc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ where
2727
reader.set_read_mode(ReadMode::UntilFull);
2828

2929
// TODO if the request is large enough, should we spawn a task for it?
30-
let mut writer = async move {
30+
let writer = async move {
3131
while !request.buffer_is_empty() {
3232
writer.write_from_fin(&mut request).await?;
3333
}
@@ -39,7 +39,7 @@ where
3939
let mut writer = core::pin::pin!(writer);
4040
let mut writer_finished = false;
4141

42-
let mut reader = async move {
42+
let reader = async move {
4343
loop {
4444
let storage = response.provide_storage().await?;
4545

dc/s2n-quic-dc/src/stream/send/flow/blocking.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ mod tests {
233233
let mut at_least_one_write = true;
234234
for (idx, count) in worker_counts.into_iter().enumerate() {
235235
let count = count.load(Ordering::Relaxed);
236-
eprintln!("thread={idx}, count={}", count);
236+
eprintln!("thread={idx}, count={count}");
237237
if count == 0 {
238238
at_least_one_write = false;
239239
}

dc/s2n-quic-dc/src/stream/send/flow/non_blocking.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ mod tests {
308308
let mut at_least_one_write = true;
309309
for (idx, count) in worker_counts.into_iter().enumerate() {
310310
let count = count.load(Ordering::Relaxed);
311-
println!("thread={idx}, count={}", count);
311+
println!("thread={idx}, count={count}");
312312
if count == 0 {
313313
at_least_one_write = false;
314314
}

dc/s2n-quic-dc/src/task/waker/set.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ impl Set {
4747
/// Returns all of the IDs that are woken
4848
#[inline]
4949
pub fn drain(&mut self) -> impl Iterator<Item = usize> + '_ {
50-
core::mem::swap(&mut self.ready, &mut self.state.ready.lock().unwrap());
50+
let mut state = self.state.ready.lock().unwrap();
51+
core::mem::swap(&mut self.ready, &mut state);
5152
self.ready.drain()
5253
}
5354
}

quic/s2n-quic-core/src/buffer/reassembler/tests.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,17 +1066,15 @@ fn allocation_size_test() {
10661066
assert_eq!(
10671067
Reassembler::allocation_size(offset),
10681068
size,
1069-
"offset = {}",
1070-
offset
1069+
"offset = {offset}"
10711070
);
10721071

10731072
if let Some((offset, _)) = received.get(index + 1) {
10741073
let offset = offset - 1;
10751074
assert_eq!(
10761075
Reassembler::allocation_size(offset),
10771076
size,
1078-
"offset = {}",
1079-
offset
1077+
"offset = {offset}"
10801078
);
10811079
}
10821080
}

quic/s2n-quic-core/src/crypto/tls/null.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ impl<T> Default for Endpoint<T> {
6060
████████████████████████████████████████████████████████████████
6161
▓▓████████████████████████████████████████████████████████████▓▓
6262
";
63-
eprintln!("{}", WARNING);
63+
eprintln!("{WARNING}");
6464
eprintln!();
6565
eprintln!(" ===== W A R N I N G !!! =====");
6666
eprintln!();
@@ -72,7 +72,7 @@ impl<T> Default for Endpoint<T> {
7272
eprintln!(" integrity, or authenticity.");
7373
eprintln!();
7474
let location = core::panic::Location::caller();
75-
eprintln!(" Endpoint configured by: {}", location);
75+
eprintln!(" Endpoint configured by: {location}");
7676
eprintln!();
7777
eprintln!(" ==============================");
7878
}

quic/s2n-quic-core/src/frame/crypto.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,7 @@ mod tests {
165165

166166
assert!(
167167
frame.encoding_size() <= capacity,
168-
"the encoding_size should not exceed capacity {:#?}",
169-
frame
168+
"the encoding_size should not exceed capacity {frame:#?}"
170169
);
171170

172171
if new_length < length {
@@ -190,8 +189,7 @@ mod tests {
190189
} else {
191190
assert!(
192191
frame.encoding_size() > capacity,
193-
"rejection should only occur when encoding size > capacity {:#?}",
194-
frame
192+
"rejection should only occur when encoding size > capacity {frame:#?}"
195193
);
196194
}
197195
}

quic/s2n-quic-core/src/frame/stream.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,7 @@ mod tests {
319319
// we should never exceed the capacity
320320
assert!(
321321
frame.encoding_size() <= capacity,
322-
"the encoding_size should not exceed capacity {:#?}",
323-
frame
322+
"the encoding_size should not exceed capacity {frame:#?}"
324323
);
325324

326325
if new_length < length {
@@ -346,15 +345,13 @@ mod tests {
346345
assert_eq!(
347346
frame.encoding_size(),
348347
capacity,
349-
"should only be the last frame if == capacity {:#?}",
350-
frame
348+
"should only be the last frame if == capacity {frame:#?}"
351349
);
352350
}
353351
} else {
354352
assert!(
355353
frame.encoding_size() > capacity,
356-
"rejection should only occur when encoding size > capacity {:#?}",
357-
frame
354+
"rejection should only occur when encoding size > capacity {frame:#?}"
358355
);
359356
}
360357
}

quic/s2n-quic-core/src/packet/number/map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ mod tests {
724724
}
725725
(None, None) => break,
726726
(actual, expected) => {
727-
panic!("expected: {:?}, actual: {:?}", expected, actual);
727+
panic!("expected: {expected:?}, actual: {actual:?}");
728728
}
729729
}
730730
}

0 commit comments

Comments
 (0)