Skip to content

Commit 589c38a

Browse files
committed
Merge pull request #20515 from tshepang/modernise-ping-pong-benchmark
bench: remove warnings from rt-messaging-ping-pong.rs Reviewed-by: alexcrichton
2 parents f1cda51 + f863e82 commit 589c38a

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/test/bench/rt-messaging-ping-pong.rs

+8-9
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
use std::sync::mpsc::channel;
2121
use std::os;
2222
use std::thread::Thread;
23-
use std::uint;
2423

2524
// This is a simple bench that creates M pairs of tasks. These
2625
// tasks ping-pong back and forth over a pair of streams. This is a
@@ -31,24 +30,24 @@ fn ping_pong_bench(n: uint, m: uint) {
3130

3231
// Create pairs of tasks that pingpong back and forth.
3332
fn run_pair(n: uint) {
34-
// Create a stream A->B
35-
let (atx, arx) = channel::<()>();
36-
// Create a stream B->A
37-
let (btx, brx) = channel::<()>();
33+
// Create a channel: A->B
34+
let (atx, arx) = channel();
35+
// Create a channel: B->A
36+
let (btx, brx) = channel();
3837

3938
Thread::spawn(move|| {
4039
let (tx, rx) = (atx, brx);
4140
for _ in range(0, n) {
42-
tx.send(());
43-
rx.recv();
41+
tx.send(()).unwrap();
42+
rx.recv().unwrap();
4443
}
4544
}).detach();
4645

4746
Thread::spawn(move|| {
4847
let (tx, rx) = (btx, arx);
4948
for _ in range(0, n) {
50-
rx.recv();
51-
tx.send(());
49+
rx.recv().unwrap();
50+
tx.send(()).unwrap();
5251
}
5352
}).detach();
5453
}

0 commit comments

Comments
 (0)