diff --git a/nexosim/src/ports/output/broadcaster.rs b/nexosim/src/ports/output/broadcaster.rs index 4da1d4a..ba5f22b 100644 --- a/nexosim/src/ports/output/broadcaster.rs +++ b/nexosim/src/ports/output/broadcaster.rs @@ -672,7 +672,7 @@ mod tests { let th_broadcast = thread::spawn(move || { let iter = block_on(broadcaster.broadcast(MESSAGE)).unwrap(); - let sum = iter.fold(0, |acc, val| acc + val); + let sum = iter.sum::(); sum }); @@ -727,11 +727,7 @@ mod tests { // Send messages reaching only one receiver each. for id in 0..N_RECV { - sum += broadcaster - .broadcast(id) - .await - .unwrap() - .fold(0, |acc, val| acc + val); + sum += broadcaster.broadcast(id).await.unwrap().sum::(); } // Broadcast the special value to all receivers. @@ -739,15 +735,11 @@ mod tests { .broadcast(BROADCAST_ALL) .await .unwrap() - .fold(0, |acc, val| acc + val); + .sum::(); // Send again messages reaching only one receiver each. for id in 0..N_RECV { - sum += broadcaster - .broadcast(id) - .await - .unwrap() - .fold(0, |acc, val| acc + val); + sum += broadcaster.broadcast(id).await.unwrap().sum::(); } sum diff --git a/nexosim/src/ports/source/broadcaster.rs b/nexosim/src/ports/source/broadcaster.rs index 69c91ed..64c45e7 100644 --- a/nexosim/src/ports/source/broadcaster.rs +++ b/nexosim/src/ports/source/broadcaster.rs @@ -567,7 +567,7 @@ mod tests { let th_broadcast = thread::spawn(move || { let iter = block_on(broadcaster.broadcast(MESSAGE)).unwrap(); - let sum = iter.fold(0, |acc, val| acc + val); + let sum = iter.sum::(); sum }); @@ -622,11 +622,7 @@ mod tests { // Send messages reaching only one receiver each. for id in 0..N_RECV { - sum += broadcaster - .broadcast(id) - .await - .unwrap() - .fold(0, |acc, val| acc + val); + sum += broadcaster.broadcast(id).await.unwrap().sum::(); } // Broadcast the special value to all receivers. @@ -634,15 +630,11 @@ mod tests { .broadcast(BROADCAST_ALL) .await .unwrap() - .fold(0, |acc, val| acc + val); + .sum::(); // Send again messages reaching only one receiver each. for id in 0..N_RECV { - sum += broadcaster - .broadcast(id) - .await - .unwrap() - .fold(0, |acc, val| acc + val); + sum += broadcaster.broadcast(id).await.unwrap().sum::(); } sum