Code change:
// option. This file may not be copied, modified, or distributed // except according to those terms. <del> use prelude::*; use std::rand; use std::rand::Rng; use test::{Bencher, black_box}; pub fn insert_rand_n<M, I, R>(n: usize, map: &mut M, b: &mut Bencher, mut insert: I, mut remove: R) where I: FnMut(&mut M, usize), R: FnMut(&mut M, usize), { // setup let mut rng = rand::weak_rng(); for _ in 0..n { insert(map, rng.gen::<usize>() % n); } // measure b.iter(|| { let k = rng.gen::<usize>() % n; insert(map, k); remove(map, k); }); black_box(map); </del> <ins> macro_rules! map_insert_rand_bench { ($name: ident, $n: expr, $map: ident) => ( #[bench] pub fn $name(b: &mut ::test::Bencher) { use std::rand; use std::rand::Rng; use test::black_box; let n: usize = $n; let mut map = $map::new(); // setup let mut rng = rand::weak_rng(); for _ in 0..n { let i = rng.gen() % n; map.insert(i, i); } // measure b.iter(|| { let k = rng.gen() % n; map.insert(k, k); map.remove(&k); }); black_box(map); } ) </ins> } <del> pub fn insert_seq_n<M, I, R>(n: usize, map: &mut M, b: &mut Bencher, mut insert: I, mut remove: R) where I: FnMut(&mut M, usize), R: FnMut(&mut M, usize), { // setup for i in 0..n { insert(map, i * 2); } // measure let mut i = 1; b.iter(|| { insert(map, i); remove(map, i); i = (i + 2) % n; }); black_box(map); </del> <ins> macro_rules! map_insert_seq_bench { ($name: ident, $n: expr, $map: ident) => ( #[bench] pub fn $name(b: &mut ::test::Bencher) { use test::black_box; let mut map = $map::new(); let n: usize = $n; // setup for i in 0..n { map.insert(i * 2, i * 2); } // measure let mut i = 1; b.iter(|| { map.insert(i, i); map.remove(&i); i = (i + 2) % n; }); black_box(map); } ) </ins> } <del> pub fn find_rand_n<M, T, I, F>(n: usize, map: &mut M, b: &mut Bencher, mut insert: I, mut find: F) where I: FnMut(&mut M, usize), F: FnMut(&M, usize) -> T, { // setup let mut rng = rand::weak_rng(); let mut keys: Vec<_> = (0..n).map(|_| rng.gen::<usize>() % n).collect(); for k in &keys { insert(map, *k); } rng.shuffle(&mut keys); // measure let mut i = 0; b.iter(|| { let t = find(map, keys[i]); i = (i + 1) % n; black_box(t); }) </del> <ins> macro_rules! map_find_rand_bench { ($name: ident, $n: expr, $map: ident) => ( #[bench] pub fn $name(b: &mut ::test::Bencher) { use std::rand; use std::rand::Rng; use test::black_box; let mut map = $map::new(); let n: usize = $n; // setup let mut rng = rand::weak_rng(); let mut keys: Vec<_> = (0..n).map(|_| rng.gen() % n).collect(); for &k in &keys { map.insert(k, k); } rng.shuffle(&mut keys); // measure let mut i = 0; b.iter(|| { let t = map.get(&keys[i]); i = (i + 1) % n; black_box(t); }) } ) </ins> } <del> pub fn find_seq_n<M, T, I, F>(n: usize, map: &mut M, b: &mut Bencher, mut insert: I, mut find: F) where I: FnMut(&mut M, usize), F: FnMut(&M, usize) -> T, { // setup for i in 0..n { insert(map, i); } // measure let mut i = 0; b.iter(|| { let x = find(map, i); i = (i + 1) % n; black_box(x); }) </del> <ins> macro_rules! map_find_seq_bench { ($name: ident, $n: expr, $map: ident) => ( #[bench] pub fn $name(b: &mut ::test::Bencher) { use test::black_box; let mut map = $map::new(); let n: usize = $n; // setup for i in 0..n { map.insert(i, i); } // measure let mut i = 0; b.iter(|| { let x = map.get(&i); i = (i + 1) % n; black_box(x); }) } ) </ins> }

Related discussion:
text: the closure being passed into in BTreeMap and VecMap's benches has a trailing semi-colon making the return value , and thus making the entire operation a no-op. Removing the semi-colon causes lifetime conflict issues. CC
I have a branch that just gives up and replaces these with macros. This results in clearer and more concise code like . Confirmed produces sane results in benchmark output. Hope to submit something tomorrow.