From c8cb9291ee5c89dfa47c8dd71abf462544f97bc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Neusch=C3=A4fer?= Date: Wed, 18 Mar 2015 18:13:21 +0100 Subject: [PATCH] bench: replace iter::range with range syntax --- benches/common/macros.rs | 12 ++++++------ benches/construction.rs | 5 ++--- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/benches/common/macros.rs b/benches/common/macros.rs index 91cc219..84f6bc2 100644 --- a/benches/common/macros.rs +++ b/benches/common/macros.rs @@ -21,8 +21,8 @@ macro_rules! bench_binop( let mut rng = IsaacRng::new_unseeded(); - let elems1: Vec<$t1> = range(0, LEN).map(|_| rng.gen::<$t1>()).collect(); - let elems2: Vec<$t2> = range(0, LEN).map(|_| rng.gen::<$t2>()).collect(); + let elems1: Vec<$t1> = (0..LEN).map(|_| rng.gen::<$t1>()).collect(); + let elems2: Vec<$t2> = (0..LEN).map(|_| rng.gen::<$t2>()).collect(); let mut i = 0; bh.iter(|| { @@ -44,8 +44,8 @@ macro_rules! bench_binop_deref( let mut rng = IsaacRng::new_unseeded(); - let elems1: Vec<$t1> = range(0, LEN).map(|_| rng.gen::<$t1>()).collect(); - let elems2: Vec<$t2> = range(0, LEN).map(|_| rng.gen::<$t2>()).collect(); + let elems1: Vec<$t1> = (0..LEN).map(|_| rng.gen::<$t1>()).collect(); + let elems2: Vec<$t2> = (0..LEN).map(|_| rng.gen::<$t2>()).collect(); let mut i = 0; bh.iter(|| { @@ -67,7 +67,7 @@ macro_rules! bench_unop( let mut rng = IsaacRng::new_unseeded(); - let mut elems: Vec<$t> = range(0, LEN).map(|_| rng.gen::<$t>()).collect(); + let mut elems: Vec<$t> = (0..LEN).map(|_| rng.gen::<$t>()).collect(); let mut i = 0; bh.iter(|| { @@ -89,7 +89,7 @@ macro_rules! bench_construction( let mut rng = IsaacRng::new_unseeded(); - $(let $args: Vec<$types> = range(0, LEN).map(|_| rng.gen::<$types>()).collect();)* + $(let $args: Vec<$types> = (0..LEN).map(|_| rng.gen::<$types>()).collect();)* let mut i = 0; bh.iter(|| { diff --git a/benches/construction.rs b/benches/construction.rs index 0b21379..c0ed7c9 100644 --- a/benches/construction.rs +++ b/benches/construction.rs @@ -20,7 +20,6 @@ extern crate test; extern crate cgmath; use rand::{IsaacRng, Rng}; -use std::iter; use test::Bencher; use cgmath::{Quaternion, Basis2, Basis3, Vector3, Rotation2, Rotation3, Rad}; @@ -32,8 +31,8 @@ fn bench_from_axis_angle>(bh: &mut Bencher) { let mut rng = IsaacRng::new_unseeded(); - let axis: Vec<_> = iter::range(0, LEN).map(|_| rng.gen::>()).collect(); - let angle: Vec<_> = iter::range(0, LEN).map(|_| rng.gen::>()).collect(); + let axis: Vec<_> = (0..LEN).map(|_| rng.gen::>()).collect(); + let angle: Vec<_> = (0..LEN).map(|_| rng.gen::>()).collect(); let mut i = 0; bh.iter(|| {