Skip to content

Commit 0f4ee2d

Browse files
committed
bench: fix a few compiler warnings
1 parent 2a8cb67 commit 0f4ee2d

19 files changed

+14
-43
lines changed

src/test/bench/core-map.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ use std::collections::{BTreeMap, HashMap, HashSet};
1414
use std::os;
1515
use std::rand::{Rng, IsaacRng, SeedableRng};
1616
use std::time::Duration;
17-
use std::uint;
1817

1918
fn timed<F>(label: &str, f: F) where F: FnMut() {
2019
println!(" {}: {}", label, Duration::span(f));

src/test/bench/core-set.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ use std::collections::HashSet;
2121
use std::hash::Hash;
2222
use std::os;
2323
use std::time::Duration;
24-
use std::uint;
2524

2625
struct Results {
2726
sequential_ints: Duration,

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
// except according to those terms.
1010

1111
use std::os;
12-
use std::uint;
1312

1413
fn main() {
1514
let args = os::args();

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ use std::sync::mpsc::{channel, Sender, Receiver};
2222
use std::os;
2323
use std::thread::Thread;
2424
use std::time::Duration;
25-
use std::uint;
2625

2726
fn move_out<T>(_x: T) {}
2827

src/test/bench/msgsend-pipes.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ use std::sync::mpsc::{channel, Sender, Receiver};
1818
use std::os;
1919
use std::thread::Thread;
2020
use std::time::Duration;
21-
use std::uint;
22-
23-
fn move_out<T>(_x: T) {}
2421

2522
enum request {
2623
get_count,
@@ -42,7 +39,7 @@ fn server(requests: &Receiver<request>, responses: &Sender<uint>) {
4239
_ => { }
4340
}
4441
}
45-
responses.send(count);
42+
responses.send(count).unwrap();
4643
//println!("server exiting");
4744
}
4845

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
use std::os;
2222
use std::sync::{Arc, Future, Mutex, Condvar};
2323
use std::time::Duration;
24-
use std::uint;
2524

2625
// A poor man's pipe.
2726
type pipe = Arc<(Mutex<Vec<uint>>, Condvar)>;
@@ -76,7 +75,7 @@ fn main() {
7675
let num_tasks = args[1].parse::<uint>().unwrap();
7776
let msg_per_task = args[2].parse::<uint>().unwrap();
7877

79-
let (mut num_chan, num_port) = init();
78+
let (num_chan, num_port) = init();
8079

8180
let mut p = Some((num_chan, num_port));
8281
let dur = Duration::span(|| {

src/test/bench/rt-parfib.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,22 @@
1111
use std::sync::mpsc::channel;
1212
use std::os;
1313
use std::thread::Thread;
14-
use std::uint;
1514

1615
// A simple implementation of parfib. One subtree is found in a new
1716
// task and communicated over a oneshot pipe, the other is found
1817
// locally. There is no sequential-mode threshold.
1918

2019
fn parfib(n: uint) -> uint {
21-
if(n == 0 || n == 1) {
20+
if n == 0 || n == 1 {
2221
return 1;
2322
}
2423

2524
let (tx, rx) = channel();
2625
Thread::spawn(move|| {
27-
tx.send(parfib(n-1));
26+
tx.send(parfib(n-1)).unwrap();
2827
});
2928
let m2 = parfib(n-2);
30-
return (rx.recv().unwrap() + m2);
29+
return rx.recv().unwrap() + m2;
3130
}
3231

3332
fn main() {

src/test/bench/shootout-binarytrees.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ fn main() {
9292
let long_lived_arena = TypedArena::new();
9393
let long_lived_tree = bottom_up_tree(&long_lived_arena, 0, max_depth);
9494

95-
let mut messages = range_step(min_depth, max_depth + 1, 2).map(|depth| {
95+
let messages = range_step(min_depth, max_depth + 1, 2).map(|depth| {
9696
use std::num::Int;
9797
let iterations = 2i.pow((max_depth - depth + min_depth) as uint);
9898
Thread::scoped(move|| {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ fn rendezvous(nn: uint, set: Vec<Color>) {
182182
let (to_rendezvous_log, from_creatures_log) = channel::<String>();
183183

184184
// these channels will allow us to talk to each creature by 'name'/index
185-
let mut to_creature: Vec<Sender<CreatureInfo>> =
185+
let to_creature: Vec<Sender<CreatureInfo>> =
186186
set.iter().enumerate().map(|(ii, &col)| {
187187
// create each creature as a listener with a port, and
188188
// give us a channel to talk to each

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ impl Perm {
130130
}
131131

132132

133-
fn reverse(tperm: &mut [i32], mut k: uint) {
133+
fn reverse(tperm: &mut [i32], k: uint) {
134134
tperm.slice_to_mut(k).reverse()
135135
}
136136

@@ -165,7 +165,7 @@ fn fannkuch(n: i32) -> (i32, i32) {
165165
let mut futures = vec![];
166166
let k = perm.max() / N;
167167

168-
for (i, j) in range(0, N).zip(iter::count(0, k)) {
168+
for (_, j) in range(0, N).zip(iter::count(0, k)) {
169169
let max = cmp::min(j+k, perm.max());
170170

171171
futures.push(Thread::scoped(move|| {

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
#![feature(slicing_syntax)]
4444

4545
use std::ascii::OwnedAsciiExt;
46-
use std::iter::repeat;
4746
use std::slice;
4847
use std::sync::Arc;
4948
use std::thread::Thread;

src/test/bench/shootout-nbody.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,6 @@ fn shift_mut_ref<'a, T>(r: &mut &'a mut [T]) -> Option<&'a mut T> {
202202
raw.data = raw.data.offset(1);
203203
raw.len -= 1;
204204
*r = mem::transmute(raw);
205-
Some(unsafe { &mut *ret })
205+
Some({ &mut *ret })
206206
}
207207
}

src/test/bench/shootout-reverse-complement.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ unsafe impl<T: 'static> Send for Racy<T> {}
229229

230230
/// Executes a closure in parallel over the given iterator over mutable slice.
231231
/// The closure `f` is run in parallel with an element of `iter`.
232-
fn parallel<'a, I, T, F>(mut iter: I, f: F)
232+
fn parallel<'a, I, T, F>(iter: I, f: F)
233233
where T: 'a+Send + Sync,
234234
I: Iterator<Item=&'a mut [T]>,
235235
F: Fn(&mut [T]) + Sync {

src/test/bench/shootout-threadring.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ use std::thread::Thread;
4343

4444
fn start(n_tasks: int, token: int) {
4545
let (tx, mut rx) = channel();
46-
tx.send(token);
46+
tx.send(token).unwrap();
4747
for i in range(2, n_tasks + 1) {
4848
let (tx, next_rx) = channel();
4949
Thread::spawn(move|| roundtrip(i, tx, rx));
@@ -58,7 +58,7 @@ fn roundtrip(id: int, tx: Sender<int>, rx: Receiver<int>) {
5858
println!("{}", id);
5959
break;
6060
}
61-
tx.send(token - 1);
61+
tx.send(token - 1).unwrap();
6262
}
6363
}
6464

src/test/bench/std-smallintmap.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
use std::collections::VecMap;
1414
use std::os;
1515
use std::time::Duration;
16-
use std::uint;
1716

1817
fn append_sequential(min: uint, max: uint, map: &mut VecMap<uint>) {
1918
for i in range(min, max) {

src/test/bench/sudoku.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,6 @@ impl Sudoku {
5454
return Sudoku::new(g)
5555
}
5656

57-
pub fn equal(&self, other: &Sudoku) -> bool {
58-
for row in range(0u8, 9u8) {
59-
for col in range(0u8, 9u8) {
60-
if self.grid[row as uint][col as uint] !=
61-
other.grid[row as uint][col as uint] {
62-
return false;
63-
}
64-
}
65-
}
66-
return true;
67-
}
68-
6957
pub fn read(mut reader: &mut BufferedReader<StdReader>) -> Sudoku {
7058
/* assert first line is exactly "9,9" */
7159
assert!(reader.read_line().unwrap() == "9,9".to_string());
@@ -183,7 +171,7 @@ impl Colors {
183171
fn next(&self) -> u8 {
184172
let Colors(c) = *self;
185173
let val = c & HEADS;
186-
if (0u16 == val) {
174+
if 0u16 == val {
187175
return 0u8;
188176
} else {
189177
return val.trailing_zeros() as u8

src/test/bench/task-perf-alloc-unwind.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ enum List<T> {
1919
Nil, Cons(T, Box<List<T>>)
2020
}
2121

22-
enum UniqueList {
23-
ULNil, ULCons(Box<UniqueList>)
24-
}
25-
2622
fn main() {
2723
let (repeat, depth) = if os::getenv("RUST_BENCH").is_some() {
2824
(50, 1000)

src/test/bench/task-perf-jargon-metal-smoke.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
use std::sync::mpsc::{channel, Sender};
2121
use std::os;
2222
use std::thread::Thread;
23-
use std::uint;
2423

2524
fn child_generation(gens_left: uint, tx: Sender<()>) {
2625
// This used to be O(n^2) in the number of generations that ever existed.

src/test/bench/task-perf-spawnalot.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
// except according to those terms.
1010

1111
use std::os;
12-
use std::uint;
1312
use std::thread::Thread;
1413

1514
fn f(n: uint) {

0 commit comments

Comments
 (0)