Skip to content

Commit f863e82

Browse files
committed
bench: remove warnings from rt-messaging-ping-pong.rs
1 parent 470118f commit f863e82

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

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

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@
1919

2020
use std::sync::mpsc::channel;
2121
use std::os;
22-
use std::str::from_str;
2322
use std::thread::Thread;
24-
use std::uint;
2523

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

3331
// Create pairs of tasks that pingpong back and forth.
3432
fn run_pair(n: uint) {
35-
// Create a stream A->B
36-
let (atx, arx) = channel::<()>();
37-
// Create a stream B->A
38-
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();
3937

4038
Thread::spawn(move|| {
4139
let (tx, rx) = (atx, brx);
4240
for _ in range(0, n) {
43-
tx.send(());
44-
rx.recv();
41+
tx.send(()).unwrap();
42+
rx.recv().unwrap();
4543
}
4644
}).detach();
4745

4846
Thread::spawn(move|| {
4947
let (tx, rx) = (btx, arx);
5048
for _ in range(0, n) {
51-
rx.recv();
52-
tx.send(());
49+
rx.recv().unwrap();
50+
tx.send(()).unwrap();
5351
}
5452
}).detach();
5553
}
@@ -66,13 +64,13 @@ fn main() {
6664
let args = os::args();
6765
let args = args.as_slice();
6866
let n = if args.len() == 3 {
69-
from_str::<uint>(args[1].as_slice()).unwrap()
67+
args[1].parse::<uint>().unwrap()
7068
} else {
7169
10000
7270
};
7371

7472
let m = if args.len() == 3 {
75-
from_str::<uint>(args[2].as_slice()).unwrap()
73+
args[2].parse::<uint>().unwrap()
7674
} else {
7775
4
7876
};

0 commit comments

Comments
 (0)