From 113fed5c421f4beb211d3b85bdf78ce4bafcfefe Mon Sep 17 00:00:00 2001 From: Tristan Stenner Date: Thu, 17 Jan 2019 08:59:25 +0100 Subject: [PATCH] Update rand to 0.6 --- .travis.yml | 2 +- Cargo.lock | 6 +++--- Cargo.toml | 4 ++-- connect/Cargo.toml | 2 +- core/Cargo.toml | 4 ++-- core/build.rs | 4 +++- core/src/util/mod.rs | 6 +++--- 7 files changed, 15 insertions(+), 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index bd936967..5963b906 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: rust rust: - - 1.23.0 + - 1.26 - stable - beta - nightly diff --git a/Cargo.lock b/Cargo.lock index 9fdc3b8d..1f072f22 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -458,7 +458,7 @@ dependencies = [ "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "num-bigint 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", "protobuf 1.7.4 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "rpassword 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.9.15 (registry+https://github.com/rust-lang/crates.io-index)", @@ -505,7 +505,7 @@ dependencies = [ "mdns 0.2.0 (git+https://github.com/plietar/rust-mdns)", "num-bigint 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", "protobuf 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.9.15 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 0.9.15 (registry+https://github.com/rust-lang/crates.io-index)", @@ -534,7 +534,7 @@ dependencies = [ "num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", "protobuf 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "rpassword 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.9.15 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index 88b59667..b6ebffee 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,7 +41,7 @@ hyper = "0.11.2" log = "0.3.5" num-bigint = "0.1.35" protobuf = "1.1" -rand = "0.3.13" +rand = "0.6" rpassword = "0.3.0" rust-crypto = "0.2.36" serde = "0.9.6" @@ -54,7 +54,7 @@ tokio-signal = "0.1.2" url = "1.7.0" [build-dependencies] -rand = "0.3.13" +rand = "0.6" vergen = "0.1.0" [replace] diff --git a/connect/Cargo.toml b/connect/Cargo.toml index 193ef1f1..de46ca3a 100644 --- a/connect/Cargo.toml +++ b/connect/Cargo.toml @@ -17,7 +17,7 @@ hyper = "0.11.2" log = "0.3.5" num-bigint = "0.1.35" protobuf = "2.0.5" -rand = "0.3.13" +rand = "0.6" rust-crypto = "0.2.36" serde = "0.9.6" serde_derive = "0.9.6" diff --git a/core/Cargo.toml b/core/Cargo.toml index 82d0bce8..e441388a 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -23,7 +23,7 @@ num-bigint = "0.1.35" num-integer = "0.1.32" num-traits = "0.1.36" protobuf = "2.0.5" -rand = "0.3.13" +rand = "0.6" rpassword = "0.3.0" rust-crypto = "0.2.36" serde = "0.9.6" @@ -36,5 +36,5 @@ url = "1.7.0" uuid = { version = "0.4", features = ["v4"] } [build-dependencies] -rand = "0.3.13" +rand = "0.6" vergen = "0.1.0" diff --git a/core/build.rs b/core/build.rs index 0240a8fe..3368f2d1 100644 --- a/core/build.rs +++ b/core/build.rs @@ -2,6 +2,7 @@ extern crate rand; extern crate vergen; use rand::Rng; +use rand::distributions::Alphanumeric; use std::env; use std::fs::OpenOptions; use std::io::Write; @@ -12,7 +13,8 @@ fn main() { vergen::vergen(vergen::OutputFns::all()).unwrap(); - let build_id: String = rand::thread_rng().gen_ascii_chars().take(8).collect(); + let mut rng = rand::thread_rng(); + let build_id: String = ::std::iter::repeat(()).map(|()| rng.sample(Alphanumeric)).take(8).collect(); let mut version_file = OpenOptions::new() .write(true) diff --git a/core/src/util/mod.rs b/core/src/util/mod.rs index 7c932306..c91cac97 100644 --- a/core/src/util/mod.rs +++ b/core/src/util/mod.rs @@ -1,12 +1,12 @@ use num_bigint::BigUint; use num_integer::Integer; use num_traits::{One, Zero}; -use rand::{Rand, Rng}; +use rand::Rng; use std::mem; use std::ops::{Mul, Rem, Shr}; -pub fn rand_vec(rng: &mut G, size: usize) -> Vec { - rng.gen_iter().take(size).collect() +pub fn rand_vec(rng: &mut G, size: usize) -> Vec { + ::std::iter::repeat(()).map(|()| rng.gen()).take(size).collect() } pub fn powm(base: &BigUint, exp: &BigUint, modulus: &BigUint) -> BigUint {