Skip to content

Commit 4bcda71

Browse files
committed
Fix warnings in src/test/bench tests. Nobody will ever care.
1 parent 7ad7911 commit 4bcda71

26 files changed

+60
-78
lines changed

src/test/bench/core-std.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ macro_rules! bench (
3030

3131
fn main() {
3232
let argv = os::args();
33-
let tests = argv.slice(1, argv.len());
33+
let _tests = argv.slice(1, argv.len());
3434

3535
bench!(shift_push);
3636
bench!(read_line);
@@ -44,7 +44,7 @@ fn main() {
4444
fn maybe_run_test(argv: &[~str], name: ~str, test: &fn()) {
4545
let mut run_test = false;
4646

47-
if os::getenv(~"RUST_BENCH").is_some() {
47+
if os::getenv("RUST_BENCH").is_some() {
4848
run_test = true
4949
} else if argv.len() > 0 {
5050
run_test = argv.iter().any(|x| x == &~"all") || argv.iter().any(|x| x == &name)

src/test/bench/core-uint-to-str.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use std::uint;
1313

1414
fn main() {
1515
let args = os::args();
16-
let args = if os::getenv(~"RUST_BENCH").is_some() {
16+
let args = if os::getenv("RUST_BENCH").is_some() {
1717
~[~"", ~"10000000"]
1818
} else if args.len() <= 1u {
1919
~[~"", ~"100000"]

src/test/bench/graph500-bfs.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ fn validate(edges: ~[(node_id, node_id)],
410410
411411
fn main() {
412412
let args = os::args();
413-
let args = if os::getenv(~"RUST_BENCH").is_some() {
413+
let args = if os::getenv("RUST_BENCH").is_some() {
414414
~[~"", ~"15", ~"48"]
415415
} else if args.len() <= 1 {
416416
~[~"", ~"10", ~"16"]
@@ -447,7 +447,7 @@ fn main() {
447447
let graph_arc = arc::ARC(graph.clone());
448448
449449
do gen_search_keys(graph, num_keys).map() |root| {
450-
io::stdout().write_line(~"");
450+
io::stdout().write_line("");
451451
io::stdout().write_line(fmt!("Search key: %?", root));
452452
453453
if do_sequential {
@@ -511,7 +511,7 @@ fn main() {
511511
}
512512
};
513513
514-
io::stdout().write_line(~"");
514+
io::stdout().write_line("");
515515
io::stdout().write_line(
516516
fmt!("Total sequential: %? \t Total Parallel: %? \t Speedup: %?x",
517517
total_seq, total_par, total_seq / total_par));

src/test/bench/msgsend-pipes-shared.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,20 @@ extern mod extra;
2222

2323
use std::comm::{Port, Chan, SharedChan};
2424
use std::comm;
25-
use std::io::{Writer, WriterUtil};
2625
use std::io;
2726
use std::os;
2827
use std::task;
29-
use std::ptr;
3028
use std::uint;
31-
use std::vec;
3229

33-
fn move_out<T>(x: T) {}
30+
fn move_out<T>(_x: T) {}
3431

3532
enum request {
3633
get_count,
3734
bytes(uint),
3835
stop
3936
}
4037

41-
fn server(requests: &Port<request>, responses: &comm::Chan<uint>) {
38+
fn server(requests: &Port<request>, responses: &Chan<uint>) {
4239
let mut count = 0u;
4340
let mut done = false;
4441
while !done {
@@ -102,7 +99,7 @@ fn run(args: &[~str]) {
10299

103100
fn main() {
104101
let args = os::args();
105-
let args = if os::getenv(~"RUST_BENCH").is_some() {
102+
let args = if os::getenv("RUST_BENCH").is_some() {
106103
~[~"", ~"1000000", ~"10000"]
107104
} else if args.len() <= 1u {
108105
~[~"", ~"10000", ~"4"]

src/test/bench/msgsend-pipes.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,13 @@
1616

1717
extern mod extra;
1818

19-
use std::comm::{Port, PortSet, Chan, stream};
20-
use std::io::{Writer, WriterUtil};
19+
use std::comm::{PortSet, Chan, stream};
2120
use std::io;
2221
use std::os;
23-
use std::ptr;
2422
use std::task;
2523
use std::uint;
26-
use std::vec;
2724

28-
fn move_out<T>(x: T) {}
25+
fn move_out<T>(_x: T) {}
2926

3027
enum request {
3128
get_count,
@@ -98,7 +95,7 @@ fn run(args: &[~str]) {
9895

9996
fn main() {
10097
let args = os::args();
101-
let args = if os::getenv(~"RUST_BENCH").is_some() {
98+
let args = if os::getenv("RUST_BENCH").is_some() {
10299
~[~"", ~"1000000", ~"8"]
103100
} else if args.len() <= 1u {
104101
~[~"", ~"10000", ~"4"]

src/test/bench/msgsend-ring-mutex-arcs.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ use std::cell::Cell;
2424
use std::io;
2525
use std::os;
2626
use std::uint;
27-
use std::vec;
2827

2928
// A poor man's pipe.
3029
type pipe = arc::MutexARC<~[uint]>;
@@ -60,8 +59,8 @@ fn thread_ring(i: uint, count: uint, num_chan: pipe, num_port: pipe) {
6059
// Send/Receive lots of messages.
6160
for uint::range(0u, count) |j| {
6261
//error!("task %?, iter %?", i, j);
63-
let mut num_chan2 = num_chan.take_unwrap();
64-
let mut num_port2 = num_port.take_unwrap();
62+
let num_chan2 = num_chan.take_unwrap();
63+
let num_port2 = num_port.take_unwrap();
6564
send(&num_chan2, i * j);
6665
num_chan = Some(num_chan2);
6766
let _n = recv(&num_port2);
@@ -72,7 +71,7 @@ fn thread_ring(i: uint, count: uint, num_chan: pipe, num_port: pipe) {
7271

7372
fn main() {
7473
let args = os::args();
75-
let args = if os::getenv(~"RUST_BENCH").is_some() {
74+
let args = if os::getenv("RUST_BENCH").is_some() {
7675
~[~"", ~"100", ~"10000"]
7776
} else if args.len() <= 1u {
7877
~[~"", ~"10", ~"100"]
@@ -84,7 +83,7 @@ fn main() {
8483
let msg_per_task = uint::from_str(args[2]).get();
8584

8685
let (num_chan, num_port) = init();
87-
let mut num_chan = Cell::new(num_chan);
86+
let num_chan = Cell::new(num_chan);
8887

8988
let start = time::precise_time_s();
9089

src/test/bench/msgsend-ring-pipes.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ use std::cell::Cell;
2424
use std::io;
2525
use std::os;
2626
use std::pipes::recv;
27-
use std::ptr;
2827
use std::uint;
2928
use std::util;
3029

@@ -58,7 +57,7 @@ fn thread_ring(i: uint,
5857

5958
fn main() {
6059
let args = os::args();
61-
let args = if os::getenv(~"RUST_BENCH").is_some() {
60+
let args = if os::getenv("RUST_BENCH").is_some() {
6261
~[~"", ~"100", ~"10000"]
6362
} else if args.len() <= 1u {
6463
~[~"", ~"100", ~"1000"]
@@ -70,7 +69,7 @@ fn main() {
7069
let msg_per_task = uint::from_str(args[2]).get();
7170

7271
let (num_port, num_chan) = ring::init();
73-
let mut num_chan = Cell::new(num_chan);
72+
let num_chan = Cell::new(num_chan);
7473

7574
let start = time::precise_time_s();
7675

src/test/bench/msgsend-ring-rw-arcs.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ use std::cell::Cell;
2424
use std::io;
2525
use std::os;
2626
use std::uint;
27-
use std::vec;
2827

2928
// A poor man's pipe.
3029
type pipe = arc::RWARC<~[uint]>;
@@ -56,8 +55,8 @@ fn thread_ring(i: uint, count: uint, num_chan: pipe, num_port: pipe) {
5655
// Send/Receive lots of messages.
5756
for uint::range(0u, count) |j| {
5857
//error!("task %?, iter %?", i, j);
59-
let mut num_chan2 = num_chan.take_unwrap();
60-
let mut num_port2 = num_port.take_unwrap();
58+
let num_chan2 = num_chan.take_unwrap();
59+
let num_port2 = num_port.take_unwrap();
6160
send(&num_chan2, i * j);
6261
num_chan = Some(num_chan2);
6362
let _n = recv(&num_port2);
@@ -68,7 +67,7 @@ fn thread_ring(i: uint, count: uint, num_chan: pipe, num_port: pipe) {
6867

6968
fn main() {
7069
let args = os::args();
71-
let args = if os::getenv(~"RUST_BENCH").is_some() {
70+
let args = if os::getenv("RUST_BENCH").is_some() {
7271
~[~"", ~"100", ~"10000"]
7372
} else if args.len() <= 1u {
7473
~[~"", ~"10", ~"100"]
@@ -80,7 +79,7 @@ fn main() {
8079
let msg_per_task = uint::from_str(args[2]).get();
8180

8281
let (num_chan, num_port) = init();
83-
let mut num_chan = Cell::new(num_chan);
82+
let num_chan = Cell::new(num_chan);
8483

8584
let start = time::precise_time_s();
8685

src/test/bench/pingpong.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ fn timeit(f: &fn()) -> float {
190190
}
191191

192192
fn main() {
193-
let count = if os::getenv(~"RUST_BENCH").is_some() {
193+
let count = if os::getenv("RUST_BENCH").is_some() {
194194
250000
195195
} else {
196196
100

src/test/bench/shootout-ackermann.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ fn ack(m: int, n: int) -> int {
2828

2929
fn main() {
3030
let args = os::args();
31-
let args = if os::getenv(~"RUST_BENCH").is_some() {
31+
let args = if os::getenv("RUST_BENCH").is_some() {
3232
~[~"", ~"12"]
3333
} else if args.len() <= 1u {
3434
~[~"", ~"8"]

src/test/bench/shootout-binarytrees.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ fn main() {
4040
use std::os;
4141
use std::int;
4242
let args = std::os::args();
43-
let args = if os::getenv(~"RUST_BENCH").is_some() {
43+
let args = if os::getenv("RUST_BENCH").is_some() {
4444
~[~"", ~"17"]
4545
} else if args.len() <= 1u {
4646
~[~"", ~"8"]

src/test/bench/shootout-chameneos-redux.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,13 @@
1212

1313
extern mod extra;
1414

15-
use extra::sort;
1615
use std::cell::Cell;
1716
use std::comm::*;
1817
use std::io;
1918
use std::option;
2019
use std::os;
2120
use std::task;
2221
use std::uint;
23-
use std::vec;
2422

2523
fn print_complements() {
2624
let all = [Blue, Red, Yellow];
@@ -206,7 +204,7 @@ fn rendezvous(nn: uint, set: ~[color]) {
206204

207205
fn main() {
208206
let args = os::args();
209-
let args = if os::getenv(~"RUST_BENCH").is_some() {
207+
let args = if os::getenv("RUST_BENCH").is_some() {
210208
~[~"", ~"200000"]
211209
} else if args.len() <= 1u {
212210
~[~"", ~"600"]
@@ -217,10 +215,10 @@ fn main() {
217215
let nn = uint::from_str(args[1]).get();
218216

219217
print_complements();
220-
io::println(~"");
218+
io::println("");
221219

222220
rendezvous(nn, ~[Blue, Red, Yellow]);
223-
io::println(~"");
221+
io::println("");
224222

225223
rendezvous(nn,
226224
~[Blue, Red, Yellow, Red, Yellow, Blue, Red, Yellow, Red, Blue]);

src/test/bench/shootout-fasta-redux.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use std::cast::transmute;
22
use std::from_str::FromStr;
33
use std::libc::{FILE, STDOUT_FILENO, c_int, fdopen, fputc, fputs, fwrite, size_t};
44
use std::os;
5-
use std::str;
65
use std::uint::{min, range};
76
use std::vec::bytes::copy_memory;
87
use std::vec;

src/test/bench/shootout-fibo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ fn fib(n: int) -> int {
2424

2525
fn main() {
2626
let args = os::args();
27-
let args = if os::getenv(~"RUST_BENCH").is_some() {
27+
let args = if os::getenv("RUST_BENCH").is_some() {
2828
~[~"", ~"40"]
2929
} else if args.len() <= 1u {
3030
~[~"", ~"30"]

src/test/bench/shootout-k-nucleotide-pipes.rs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ fn windows_with_carry(bb: &[u8], nn: uint,
121121
}
122122

123123
fn make_sequence_processor(sz: uint,
124-
from_parent: &comm::Port<~[u8]>,
125-
to_parent: &comm::Chan<~str>) {
124+
from_parent: &Port<~[u8]>,
125+
to_parent: &Chan<~str>) {
126126
let mut freqs: HashMap<~[u8], uint> = HashMap::new();
127127
let mut carry: ~[u8] = ~[];
128128
let mut total: uint = 0u;
@@ -143,11 +143,11 @@ fn make_sequence_processor(sz: uint,
143143
let buffer = match sz {
144144
1u => { sort_and_fmt(&freqs, total) }
145145
2u => { sort_and_fmt(&freqs, total) }
146-
3u => { fmt!("%u\t%s", find(&freqs, ~"GGT"), ~"GGT") }
147-
4u => { fmt!("%u\t%s", find(&freqs, ~"GGTA"), ~"GGTA") }
148-
6u => { fmt!("%u\t%s", find(&freqs, ~"GGTATT"), ~"GGTATT") }
149-
12u => { fmt!("%u\t%s", find(&freqs, ~"GGTATTTTAATT"), ~"GGTATTTTAATT") }
150-
18u => { fmt!("%u\t%s", find(&freqs, ~"GGTATTTTAATTTATAGT"), ~"GGTATTTTAATTTATAGT") }
146+
3u => { fmt!("%u\t%s", find(&freqs, ~"GGT"), "GGT") }
147+
4u => { fmt!("%u\t%s", find(&freqs, ~"GGTA"), "GGTA") }
148+
6u => { fmt!("%u\t%s", find(&freqs, ~"GGTATT"), "GGTATT") }
149+
12u => { fmt!("%u\t%s", find(&freqs, ~"GGTATTTTAATT"), "GGTATTTTAATT") }
150+
18u => { fmt!("%u\t%s", find(&freqs, ~"GGTATTTTAATTTATAGT"), "GGTATTTTAATTTATAGT") }
151151
_ => { ~"" }
152152
};
153153
@@ -156,8 +156,7 @@ fn make_sequence_processor(sz: uint,
156156
157157
// given a FASTA file on stdin, process sequence THREE
158158
fn main() {
159-
let args = os::args();
160-
let rdr = if os::getenv(~"RUST_BENCH").is_some() {
159+
let rdr = if os::getenv("RUST_BENCH").is_some() {
161160
// FIXME: Using this compile-time env variable is a crummy way to
162161
// get to this massive data set, but include_bin! chokes on it (#2598)
163162
let path = Path(env!("CFG_SRC_DIR"))
@@ -203,7 +202,7 @@ fn main() {
203202
204203
// start processing if this is the one
205204
('>', false) => {
206-
match line.slice_from(1).find_str(~"THREE") {
205+
match line.slice_from(1).find_str("THREE") {
207206
option::Some(_) => { proc_mode = true; }
208207
option::None => { }
209208
}
@@ -217,7 +216,7 @@ fn main() {
217216
let line_bytes = line.as_bytes();
218217

219218
for sizes.iter().enumerate().advance |(ii, _sz)| {
220-
let mut lb = line_bytes.to_owned();
219+
let lb = line_bytes.to_owned();
221220
to_child[ii].send(lb);
222221
}
223222
}

src/test/bench/shootout-nbody.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use std::from_str::FromStr;
22
use std::os;
33
use std::uint::range;
4-
use std::vec;
54

65
static PI: f64 = 3.141592653589793;
76
static SOLAR_MASS: f64 = 4.0 * PI * PI;

src/test/bench/shootout-pfib.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ use std::io::WriterUtil;
2828
use std::io;
2929
use std::os;
3030
use std::result::{Ok, Err};
31-
use std::str;
3231
use std::task;
3332
use std::u64;
3433
use std::uint;
@@ -59,13 +58,13 @@ struct Config {
5958
}
6059

6160
fn parse_opts(argv: ~[~str]) -> Config {
62-
let opts = ~[getopts::optflag(~"stress")];
61+
let opts = ~[getopts::optflag("stress")];
6362

6463
let opt_args = argv.slice(1, argv.len());
6564

6665
match getopts::getopts(opt_args, opts) {
6766
Ok(ref m) => {
68-
return Config {stress: getopts::opt_present(m, ~"stress")}
67+
return Config {stress: getopts::opt_present(m, "stress")}
6968
}
7069
Err(_) => { fail!(); }
7170
}
@@ -97,7 +96,7 @@ fn stress(num_tasks: int) {
9796

9897
fn main() {
9998
let args = os::args();
100-
let args = if os::getenv(~"RUST_BENCH").is_some() {
99+
let args = if os::getenv("RUST_BENCH").is_some() {
101100
~[~"", ~"20"]
102101
} else if args.len() <= 1u {
103102
~[~"", ~"8"]

0 commit comments

Comments
 (0)