Skip to content

bench: fix a few compiler warnings #20718

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 9, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/test/bench/core-map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use std::collections::{BTreeMap, HashMap, HashSet};
use std::os;
use std::rand::{Rng, IsaacRng, SeedableRng};
use std::time::Duration;
use std::uint;

fn timed<F>(label: &str, f: F) where F: FnMut() {
println!(" {}: {}", label, Duration::span(f));
Expand Down
1 change: 0 additions & 1 deletion src/test/bench/core-set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ use std::collections::HashSet;
use std::hash::Hash;
use std::os;
use std::time::Duration;
use std::uint;

struct Results {
sequential_ints: Duration,
Expand Down
1 change: 0 additions & 1 deletion src/test/bench/core-uint-to-str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
// except according to those terms.

use std::os;
use std::uint;

fn main() {
let args = os::args();
Expand Down
1 change: 0 additions & 1 deletion src/test/bench/msgsend-pipes-shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ use std::sync::mpsc::{channel, Sender, Receiver};
use std::os;
use std::thread::Thread;
use std::time::Duration;
use std::uint;

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

Expand Down
5 changes: 1 addition & 4 deletions src/test/bench/msgsend-pipes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ use std::sync::mpsc::{channel, Sender, Receiver};
use std::os;
use std::thread::Thread;
use std::time::Duration;
use std::uint;

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

enum request {
get_count,
Expand All @@ -42,7 +39,7 @@ fn server(requests: &Receiver<request>, responses: &Sender<uint>) {
_ => { }
}
}
responses.send(count);
responses.send(count).unwrap();
//println!("server exiting");
}

Expand Down
3 changes: 1 addition & 2 deletions src/test/bench/msgsend-ring-mutex-arcs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
use std::os;
use std::sync::{Arc, Future, Mutex, Condvar};
use std::time::Duration;
use std::uint;

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

let (mut num_chan, num_port) = init();
let (num_chan, num_port) = init();

let mut p = Some((num_chan, num_port));
let dur = Duration::span(|| {
Expand Down
7 changes: 3 additions & 4 deletions src/test/bench/rt-parfib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,22 @@
use std::sync::mpsc::channel;
use std::os;
use std::thread::Thread;
use std::uint;

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

fn parfib(n: uint) -> uint {
if(n == 0 || n == 1) {
if n == 0 || n == 1 {
return 1;
}

let (tx, rx) = channel();
Thread::spawn(move|| {
tx.send(parfib(n-1));
tx.send(parfib(n-1)).unwrap();
});
let m2 = parfib(n-2);
return (rx.recv().unwrap() + m2);
return rx.recv().unwrap() + m2;
}

fn main() {
Expand Down
2 changes: 1 addition & 1 deletion src/test/bench/shootout-binarytrees.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ fn main() {
let long_lived_arena = TypedArena::new();
let long_lived_tree = bottom_up_tree(&long_lived_arena, 0, max_depth);

let mut messages = range_step(min_depth, max_depth + 1, 2).map(|depth| {
let messages = range_step(min_depth, max_depth + 1, 2).map(|depth| {
use std::num::Int;
let iterations = 2i.pow((max_depth - depth + min_depth) as uint);
Thread::scoped(move|| {
Expand Down
2 changes: 1 addition & 1 deletion src/test/bench/shootout-chameneos-redux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ fn rendezvous(nn: uint, set: Vec<Color>) {
let (to_rendezvous_log, from_creatures_log) = channel::<String>();

// these channels will allow us to talk to each creature by 'name'/index
let mut to_creature: Vec<Sender<CreatureInfo>> =
let to_creature: Vec<Sender<CreatureInfo>> =
set.iter().enumerate().map(|(ii, &col)| {
// create each creature as a listener with a port, and
// give us a channel to talk to each
Expand Down
4 changes: 2 additions & 2 deletions src/test/bench/shootout-fannkuch-redux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ impl Perm {
}


fn reverse(tperm: &mut [i32], mut k: uint) {
fn reverse(tperm: &mut [i32], k: uint) {
tperm.slice_to_mut(k).reverse()
}

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

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

futures.push(Thread::scoped(move|| {
Expand Down
1 change: 0 additions & 1 deletion src/test/bench/shootout-k-nucleotide.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
#![feature(slicing_syntax)]

use std::ascii::OwnedAsciiExt;
use std::iter::repeat;
use std::slice;
use std::sync::Arc;
use std::thread::Thread;
Expand Down
2 changes: 1 addition & 1 deletion src/test/bench/shootout-nbody.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,6 @@ fn shift_mut_ref<'a, T>(r: &mut &'a mut [T]) -> Option<&'a mut T> {
raw.data = raw.data.offset(1);
raw.len -= 1;
*r = mem::transmute(raw);
Some(unsafe { &mut *ret })
Some({ &mut *ret })
}
}
2 changes: 1 addition & 1 deletion src/test/bench/shootout-reverse-complement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ unsafe impl<T: 'static> Send for Racy<T> {}

/// Executes a closure in parallel over the given iterator over mutable slice.
/// The closure `f` is run in parallel with an element of `iter`.
fn parallel<'a, I, T, F>(mut iter: I, f: F)
fn parallel<'a, I, T, F>(iter: I, f: F)
where T: 'a+Send + Sync,
I: Iterator<Item=&'a mut [T]>,
F: Fn(&mut [T]) + Sync {
Expand Down
4 changes: 2 additions & 2 deletions src/test/bench/shootout-threadring.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ use std::thread::Thread;

fn start(n_tasks: int, token: int) {
let (tx, mut rx) = channel();
tx.send(token);
tx.send(token).unwrap();
for i in range(2, n_tasks + 1) {
let (tx, next_rx) = channel();
Thread::spawn(move|| roundtrip(i, tx, rx));
Expand All @@ -58,7 +58,7 @@ fn roundtrip(id: int, tx: Sender<int>, rx: Receiver<int>) {
println!("{}", id);
break;
}
tx.send(token - 1);
tx.send(token - 1).unwrap();
}
}

Expand Down
1 change: 0 additions & 1 deletion src/test/bench/std-smallintmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
use std::collections::VecMap;
use std::os;
use std::time::Duration;
use std::uint;

fn append_sequential(min: uint, max: uint, map: &mut VecMap<uint>) {
for i in range(min, max) {
Expand Down
14 changes: 1 addition & 13 deletions src/test/bench/sudoku.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,6 @@ impl Sudoku {
return Sudoku::new(g)
}

pub fn equal(&self, other: &Sudoku) -> bool {
for row in range(0u8, 9u8) {
for col in range(0u8, 9u8) {
if self.grid[row as uint][col as uint] !=
other.grid[row as uint][col as uint] {
return false;
}
}
}
return true;
}

pub fn read(mut reader: &mut BufferedReader<StdReader>) -> Sudoku {
/* assert first line is exactly "9,9" */
assert!(reader.read_line().unwrap() == "9,9".to_string());
Expand Down Expand Up @@ -183,7 +171,7 @@ impl Colors {
fn next(&self) -> u8 {
let Colors(c) = *self;
let val = c & HEADS;
if (0u16 == val) {
if 0u16 == val {
return 0u8;
} else {
return val.trailing_zeros() as u8
Expand Down
4 changes: 0 additions & 4 deletions src/test/bench/task-perf-alloc-unwind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ enum List<T> {
Nil, Cons(T, Box<List<T>>)
}

enum UniqueList {
ULNil, ULCons(Box<UniqueList>)
}

fn main() {
let (repeat, depth) = if os::getenv("RUST_BENCH").is_some() {
(50, 1000)
Expand Down
1 change: 0 additions & 1 deletion src/test/bench/task-perf-jargon-metal-smoke.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
use std::sync::mpsc::{channel, Sender};
use std::os;
use std::thread::Thread;
use std::uint;

fn child_generation(gens_left: uint, tx: Sender<()>) {
// This used to be O(n^2) in the number of generations that ever existed.
Expand Down
1 change: 0 additions & 1 deletion src/test/bench/task-perf-spawnalot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
// except according to those terms.

use std::os;
use std::uint;
use std::thread::Thread;

fn f(n: uint) {
Expand Down