Skip to content

Commit de96865

Browse files
authored
Merge pull request #824 from vks/edition-2018
Use Rust 2018 and remove `build.rs`
2 parents 535ef93 + 67f3179 commit de96865

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+291
-368
lines changed

Cargo.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ Random number generators and other randomness functionality.
1212
"""
1313
keywords = ["random", "rng"]
1414
categories = ["algorithms", "no-std"]
15-
build = "build.rs"
1615
exclude = ["/utils/*", "/.travis.yml", "/appveyor.yml", ".gitignore"]
1716
autobenches = true
17+
edition = "2018"
1818

1919
[badges]
2020
travis-ci = { repository = "rust-random/rand" }
@@ -86,8 +86,5 @@ rand_xoshiro = { path = "rand_xoshiro", version = "0.3" }
8686
rand_isaac = { path = "rand_isaac", version = "0.2" }
8787
rand_xorshift = { path = "rand_xorshift", version = "0.2" }
8888

89-
[build-dependencies]
90-
autocfg = "0.1"
91-
9289
[package.metadata.docs.rs]
9390
all-features = true

benches/generators.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,6 @@
1010
#![allow(non_snake_case)]
1111

1212
extern crate test;
13-
extern crate rand;
14-
extern crate rand_isaac;
15-
extern crate rand_chacha;
16-
extern crate rand_hc;
17-
extern crate rand_pcg;
18-
extern crate rand_xorshift;
19-
extern crate rand_xoshiro;
2013

2114
const RAND_BENCH_N: u64 = 1000;
2215
const BYTES_LEN: usize = 1024;

benches/misc.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
#![feature(test)]
1010

1111
extern crate test;
12-
extern crate rand;
13-
extern crate rand_pcg;
1412

1513
const RAND_BENCH_N: u64 = 1000;
1614

@@ -25,7 +23,7 @@ fn misc_gen_bool_const(b: &mut Bencher) {
2523
let mut rng = Pcg32::from_rng(&mut thread_rng()).unwrap();
2624
b.iter(|| {
2725
let mut accum = true;
28-
for _ in 0..::RAND_BENCH_N {
26+
for _ in 0..crate::RAND_BENCH_N {
2927
accum ^= rng.gen_bool(0.18);
3028
}
3129
accum
@@ -38,7 +36,7 @@ fn misc_gen_bool_var(b: &mut Bencher) {
3836
b.iter(|| {
3937
let mut accum = true;
4038
let mut p = 0.18;
41-
for _ in 0..::RAND_BENCH_N {
39+
for _ in 0..crate::RAND_BENCH_N {
4240
accum ^= rng.gen_bool(p);
4341
p += 0.0001;
4442
}
@@ -51,7 +49,7 @@ fn misc_gen_ratio_const(b: &mut Bencher) {
5149
let mut rng = Pcg32::from_rng(&mut thread_rng()).unwrap();
5250
b.iter(|| {
5351
let mut accum = true;
54-
for _ in 0..::RAND_BENCH_N {
52+
for _ in 0..crate::RAND_BENCH_N {
5553
accum ^= rng.gen_ratio(2, 3);
5654
}
5755
accum
@@ -63,7 +61,7 @@ fn misc_gen_ratio_var(b: &mut Bencher) {
6361
let mut rng = Pcg32::from_rng(&mut thread_rng()).unwrap();
6462
b.iter(|| {
6563
let mut accum = true;
66-
for i in 2..(::RAND_BENCH_N as u32 + 2) {
64+
for i in 2..(crate::RAND_BENCH_N as u32 + 2) {
6765
accum ^= rng.gen_ratio(i, i + 1);
6866
}
6967
accum
@@ -76,7 +74,7 @@ fn misc_bernoulli_const(b: &mut Bencher) {
7674
b.iter(|| {
7775
let d = rand::distributions::Bernoulli::new(0.18).unwrap();
7876
let mut accum = true;
79-
for _ in 0..::RAND_BENCH_N {
77+
for _ in 0..crate::RAND_BENCH_N {
8078
accum ^= rng.sample(d);
8179
}
8280
accum
@@ -89,7 +87,7 @@ fn misc_bernoulli_var(b: &mut Bencher) {
8987
b.iter(|| {
9088
let mut accum = true;
9189
let mut p = 0.18;
92-
for _ in 0..::RAND_BENCH_N {
90+
for _ in 0..crate::RAND_BENCH_N {
9391
let d = Bernoulli::new(p).unwrap();
9492
accum ^= rng.sample(d);
9593
p += 0.0001;

benches/seq.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
#![allow(non_snake_case)]
1111

1212
extern crate test;
13-
extern crate rand;
14-
extern crate rand_pcg;
1513

1614
use test::Bencher;
1715

@@ -49,7 +47,7 @@ fn seq_slice_choose_1_of_1000(b: &mut Bencher) {
4947
}
5048
s
5149
});
52-
b.bytes = size_of::<usize>() as u64 * ::RAND_BENCH_N;
50+
b.bytes = size_of::<usize>() as u64 * crate::RAND_BENCH_N;
5351
}
5452

5553
macro_rules! seq_slice_choose_multiple {
@@ -91,7 +89,7 @@ fn seq_iter_choose_from_1000(b: &mut Bencher) {
9189
}
9290
s
9391
});
94-
b.bytes = size_of::<usize>() as u64 * ::RAND_BENCH_N;
92+
b.bytes = size_of::<usize>() as u64 * crate::RAND_BENCH_N;
9593
}
9694

9795
#[derive(Clone)]

build.rs

Lines changed: 0 additions & 11 deletions
This file was deleted.

examples/monte-carlo.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@
2626
2727
#![cfg(feature = "std")]
2828

29-
30-
extern crate rand;
31-
3229
use rand::distributions::{Distribution, Uniform};
3330

3431
fn main() {

examples/monty-hall.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@
2828
2929
#![cfg(feature = "std")]
3030

31-
32-
extern crate rand;
33-
3431
use rand::distributions::{Distribution, Uniform};
3532
use rand::Rng;
3633

rand_chacha/Cargo.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ ChaCha random number generator
1212
"""
1313
keywords = ["random", "rng", "chacha"]
1414
categories = ["algorithms", "no-std"]
15-
build = "build.rs"
15+
edition = "2018"
1616

1717
[badges]
1818
travis-ci = { repository = "rust-random/rand" }
@@ -22,9 +22,6 @@ appveyor = { repository = "rust-random/rand" }
2222
rand_core = { path = "../rand_core", version = "0.5" }
2323
c2-chacha = { version = "0.2.2", default-features = false }
2424

25-
[build-dependencies]
26-
autocfg = "0.1"
27-
2825
[features]
2926
default = ["std", "simd"]
3027
std = ["c2-chacha/std"]

rand_chacha/build.rs

Lines changed: 0 additions & 7 deletions
This file was deleted.

rand_chacha/src/lib.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,11 @@
1818

1919
#![cfg_attr(not(feature = "std"), no_std)]
2020

21-
extern crate c2_chacha;
22-
pub extern crate rand_core;
21+
pub use rand_core;
2322

2423
mod chacha;
2524

26-
pub use chacha::{ChaCha12Core, ChaCha12Rng, ChaCha20Core, ChaCha20Rng, ChaCha8Core, ChaCha8Rng};
25+
pub use crate::chacha::{ChaCha12Core, ChaCha12Rng, ChaCha20Core, ChaCha20Rng, ChaCha8Core, ChaCha8Rng};
2726

2827
/// ChaCha with 20 rounds
2928
pub type ChaChaRng = ChaCha20Rng;

0 commit comments

Comments
 (0)