1
0
forked from ROMEO/nexosim

auto-fix clippy::uneccesary_fold

This commit is contained in:
Ben-PH 2025-01-22 14:42:13 +01:00
parent c75d92145e
commit 1b3966b5ae
2 changed files with 8 additions and 24 deletions

View File

@ -672,7 +672,7 @@ mod tests {
let th_broadcast = thread::spawn(move || { let th_broadcast = thread::spawn(move || {
let iter = block_on(broadcaster.broadcast(MESSAGE)).unwrap(); let iter = block_on(broadcaster.broadcast(MESSAGE)).unwrap();
let sum = iter.fold(0, |acc, val| acc + val); let sum = iter.sum::<usize>();
sum sum
}); });
@ -727,11 +727,7 @@ mod tests {
// Send messages reaching only one receiver each. // Send messages reaching only one receiver each.
for id in 0..N_RECV { for id in 0..N_RECV {
sum += broadcaster sum += broadcaster.broadcast(id).await.unwrap().sum::<usize>();
.broadcast(id)
.await
.unwrap()
.fold(0, |acc, val| acc + val);
} }
// Broadcast the special value to all receivers. // Broadcast the special value to all receivers.
@ -739,15 +735,11 @@ mod tests {
.broadcast(BROADCAST_ALL) .broadcast(BROADCAST_ALL)
.await .await
.unwrap() .unwrap()
.fold(0, |acc, val| acc + val); .sum::<usize>();
// Send again messages reaching only one receiver each. // Send again messages reaching only one receiver each.
for id in 0..N_RECV { for id in 0..N_RECV {
sum += broadcaster sum += broadcaster.broadcast(id).await.unwrap().sum::<usize>();
.broadcast(id)
.await
.unwrap()
.fold(0, |acc, val| acc + val);
} }
sum sum

View File

@ -567,7 +567,7 @@ mod tests {
let th_broadcast = thread::spawn(move || { let th_broadcast = thread::spawn(move || {
let iter = block_on(broadcaster.broadcast(MESSAGE)).unwrap(); let iter = block_on(broadcaster.broadcast(MESSAGE)).unwrap();
let sum = iter.fold(0, |acc, val| acc + val); let sum = iter.sum::<usize>();
sum sum
}); });
@ -622,11 +622,7 @@ mod tests {
// Send messages reaching only one receiver each. // Send messages reaching only one receiver each.
for id in 0..N_RECV { for id in 0..N_RECV {
sum += broadcaster sum += broadcaster.broadcast(id).await.unwrap().sum::<usize>();
.broadcast(id)
.await
.unwrap()
.fold(0, |acc, val| acc + val);
} }
// Broadcast the special value to all receivers. // Broadcast the special value to all receivers.
@ -634,15 +630,11 @@ mod tests {
.broadcast(BROADCAST_ALL) .broadcast(BROADCAST_ALL)
.await .await
.unwrap() .unwrap()
.fold(0, |acc, val| acc + val); .sum::<usize>();
// Send again messages reaching only one receiver each. // Send again messages reaching only one receiver each.
for id in 0..N_RECV { for id in 0..N_RECV {
sum += broadcaster sum += broadcaster.broadcast(id).await.unwrap().sum::<usize>();
.broadcast(id)
.await
.unwrap()
.fold(0, |acc, val| acc + val);
} }
sum sum