Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 8fd89c1

Browse files
authoredDec 23, 2018
Rollup merge of rust-lang#57032 - RalfJung:alloc-bench-deprecations, r=Centril
fix deprecation warnings in liballoc benches
2 parents 1b22d80 + 3414be0 commit 8fd89c1

File tree

6 files changed

+11
-7
lines changed

6 files changed

+11
-7
lines changed
 

‎Cargo.lock

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ dependencies = [
1818
"compiler_builtins 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
1919
"core 0.0.0",
2020
"rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
21+
"rand_xorshift 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
2122
]
2223

2324
[[package]]

‎src/liballoc/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ compiler_builtins = { version = "0.1.0", features = ['rustc-dep-of-std'] }
1515

1616
[dev-dependencies]
1717
rand = "0.6"
18+
rand_xorshift = "0.1"
1819

1920
[[test]]
2021
name = "collectionstests"

‎src/liballoc/benches/btree/map.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
use std::iter::Iterator;
1313
use std::vec::Vec;
1414
use std::collections::BTreeMap;
15-
use rand::{Rng, thread_rng};
15+
use rand::{Rng, seq::SliceRandom, thread_rng};
1616
use test::{Bencher, black_box};
1717

1818
macro_rules! map_insert_rand_bench {
@@ -78,7 +78,7 @@ macro_rules! map_find_rand_bench {
7878
map.insert(k, k);
7979
}
8080

81-
rng.shuffle(&mut keys);
81+
keys.shuffle(&mut rng);
8282

8383
// measure
8484
let mut i = 0;

‎src/liballoc/benches/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#![feature(test)]
1414

1515
extern crate rand;
16+
extern crate rand_xorshift;
1617
extern crate test;
1718

1819
mod btree;

‎src/liballoc/benches/slice.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ use rand::{thread_rng};
1212
use std::mem;
1313
use std::ptr;
1414

15-
use rand::{Rng, SeedableRng, XorShiftRng};
15+
use rand::{Rng, SeedableRng};
1616
use rand::distributions::{Standard, Alphanumeric};
17+
use rand_xorshift::XorShiftRng;
1718
use test::{Bencher, black_box};
1819

1920
#[bench]

‎src/liballoc/benches/str.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -274,11 +274,11 @@ make_test!(split_a_str, s, s.split("a").count());
274274
make_test!(trim_ascii_char, s, {
275275
s.trim_matches(|c: char| c.is_ascii())
276276
});
277-
make_test!(trim_left_ascii_char, s, {
278-
s.trim_left_matches(|c: char| c.is_ascii())
277+
make_test!(trim_start_ascii_char, s, {
278+
s.trim_start_matches(|c: char| c.is_ascii())
279279
});
280-
make_test!(trim_right_ascii_char, s, {
281-
s.trim_right_matches(|c: char| c.is_ascii())
280+
make_test!(trim_end_ascii_char, s, {
281+
s.trim_end_matches(|c: char| c.is_ascii())
282282
});
283283

284284
make_test!(find_underscore_char, s, s.find('_'));

0 commit comments

Comments
 (0)
Please sign in to comment.