fix deprecation warnings in liballoc benches
This commit is contained in:
parent
6d34ec18c7
commit
3414be0b3e
6 changed files with 11 additions and 7 deletions
|
@ -18,6 +18,7 @@ dependencies = [
|
|||
"compiler_builtins 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"core 0.0.0",
|
||||
"rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_xorshift 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
|
@ -15,6 +15,7 @@ compiler_builtins = { version = "0.1.0", features = ['rustc-dep-of-std'] }
|
|||
|
||||
[dev-dependencies]
|
||||
rand = "0.6"
|
||||
rand_xorshift = "0.1"
|
||||
|
||||
[[test]]
|
||||
name = "collectionstests"
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
use std::iter::Iterator;
|
||||
use std::vec::Vec;
|
||||
use std::collections::BTreeMap;
|
||||
use rand::{Rng, thread_rng};
|
||||
use rand::{Rng, seq::SliceRandom, thread_rng};
|
||||
use test::{Bencher, black_box};
|
||||
|
||||
macro_rules! map_insert_rand_bench {
|
||||
|
@ -78,7 +78,7 @@ macro_rules! map_find_rand_bench {
|
|||
map.insert(k, k);
|
||||
}
|
||||
|
||||
rng.shuffle(&mut keys);
|
||||
keys.shuffle(&mut rng);
|
||||
|
||||
// measure
|
||||
let mut i = 0;
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#![feature(test)]
|
||||
|
||||
extern crate rand;
|
||||
extern crate rand_xorshift;
|
||||
extern crate test;
|
||||
|
||||
mod btree;
|
||||
|
|
|
@ -12,8 +12,9 @@ use rand::{thread_rng};
|
|||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
use rand::{Rng, SeedableRng, XorShiftRng};
|
||||
use rand::{Rng, SeedableRng};
|
||||
use rand::distributions::{Standard, Alphanumeric};
|
||||
use rand_xorshift::XorShiftRng;
|
||||
use test::{Bencher, black_box};
|
||||
|
||||
#[bench]
|
||||
|
|
|
@ -274,11 +274,11 @@ make_test!(split_a_str, s, s.split("a").count());
|
|||
make_test!(trim_ascii_char, s, {
|
||||
s.trim_matches(|c: char| c.is_ascii())
|
||||
});
|
||||
make_test!(trim_left_ascii_char, s, {
|
||||
s.trim_left_matches(|c: char| c.is_ascii())
|
||||
make_test!(trim_start_ascii_char, s, {
|
||||
s.trim_start_matches(|c: char| c.is_ascii())
|
||||
});
|
||||
make_test!(trim_right_ascii_char, s, {
|
||||
s.trim_right_matches(|c: char| c.is_ascii())
|
||||
make_test!(trim_end_ascii_char, s, {
|
||||
s.trim_end_matches(|c: char| c.is_ascii())
|
||||
});
|
||||
|
||||
make_test!(find_underscore_char, s, s.find('_'));
|
||||
|
|
Loading…
Add table
Reference in a new issue