about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/test/bench/core-set.rs11
-rw-r--r--src/test/bench/shootout-k-nucleotide-pipes.rs4
-rw-r--r--src/test/bench/shootout-meteor.rs8
3 files changed, 14 insertions, 9 deletions
diff --git a/src/test/bench/core-set.rs b/src/test/bench/core-set.rs
index 491d910f351..1dcac9fe074 100644
--- a/src/test/bench/core-set.rs
+++ b/src/test/bench/core-set.rs
@@ -61,12 +61,14 @@ impl MutableSet<uint> for BitvSet {
 
 impl Results {
     pub fn bench_int<T:MutableSet<uint>,
-                     R: rand::Rng>(
+                     R:rand::Rng,
+                     F:FnMut() -> T>(
                      &mut self,
                      rng: &mut R,
                      num_keys: uint,
                      rand_cap: uint,
-                     f: || -> T) { {
+                     mut f: F) {
+        {
             let mut set = f();
             timed(&mut self.sequential_ints, || {
                 for i in range(0u, num_keys) {
@@ -103,11 +105,12 @@ impl Results {
     }
 
     pub fn bench_str<T:MutableSet<String>,
-                     R:rand::Rng>(
+                     R:rand::Rng,
+                     F:FnMut() -> T>(
                      &mut self,
                      rng: &mut R,
                      num_keys: uint,
-                     f: || -> T) {
+                     mut f: F) {
         {
             let mut set = f();
             timed(&mut self.sequential_strings, || {
diff --git a/src/test/bench/shootout-k-nucleotide-pipes.rs b/src/test/bench/shootout-k-nucleotide-pipes.rs
index 8c0ec667332..e6ef6a8c8c9 100644
--- a/src/test/bench/shootout-k-nucleotide-pipes.rs
+++ b/src/test/bench/shootout-k-nucleotide-pipes.rs
@@ -94,7 +94,9 @@ fn update_freq(mm: &mut HashMap<Vec<u8> , uint>, key: &[u8]) {
 // given a Vec<u8>, for each window call a function
 // i.e., for "hello" and windows of size four,
 // run it("hell") and it("ello"), then return "llo"
-fn windows_with_carry(bb: &[u8], nn: uint, it: |window: &[u8]|) -> Vec<u8> {
+fn windows_with_carry<F>(bb: &[u8], nn: uint, mut it: F) -> Vec<u8> where
+    F: FnMut(&[u8]),
+{
    let mut ii = 0u;
 
    let len = bb.len();
diff --git a/src/test/bench/shootout-meteor.rs b/src/test/bench/shootout-meteor.rs
index 438775d8ba0..cdc7617fec8 100644
--- a/src/test/bench/shootout-meteor.rs
+++ b/src/test/bench/shootout-meteor.rs
@@ -53,14 +53,14 @@ use std::thread::Thread;
 
 // returns an infinite iterator of repeated applications of f to x,
 // i.e. [x, f(x), f(f(x)), ...], as haskell iterate function.
-fn iterate<'a, T>(x: T, f: |&T|: 'a -> T) -> Iterate<'a, T> {
+fn iterate<T, F>(x: T, f: F) -> Iterate<T, F> where F: FnMut(&T) -> T {
     Iterate {f: f, next: x}
 }
-struct Iterate<'a, T> {
-    f: |&T|: 'a -> T,
+struct Iterate<T, F> where F: FnMut(&T) -> T {
+    f: F,
     next: T
 }
-impl<'a, T> Iterator for Iterate<'a, T> {
+impl<T, F> Iterator for Iterate<T, F> where F: FnMut(&T) -> T {
     type Item = T;
 
     fn next(&mut self) -> Option<T> {