Bump rand crate to 0.6 (was 0.5) (#2790)

shuffle was deprecated, fix this up
This commit is contained in:
Antioch Peverell 2019-04-30 20:25:19 +01:00 committed by Ignotus Peverell
parent b2b96f3f81
commit 6352780d6a
13 changed files with 29 additions and 27 deletions

18
Cargo.lock generated
View file

@ -698,7 +698,7 @@ dependencies = [
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"lru-cache 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)",
@ -714,7 +714,7 @@ dependencies = [
"grin_servers 1.1.0-beta.2",
"grin_util 1.1.0-beta.2",
"pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)",
"toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
@ -738,7 +738,7 @@ dependencies = [
"lru-cache 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"num 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"num-bigint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)",
@ -758,7 +758,7 @@ dependencies = [
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"pbkdf2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
"ripemd160 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)",
@ -783,7 +783,7 @@ dependencies = [
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
"num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -802,7 +802,7 @@ dependencies = [
"grin_store 1.1.0-beta.2",
"grin_util 1.1.0-beta.2",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -842,7 +842,7 @@ dependencies = [
"itertools 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)",
"lmdb-zero 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)",
@ -866,7 +866,7 @@ dependencies = [
"lmdb-zero 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"memmap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -883,7 +883,7 @@ dependencies = [
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"log4rs 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)",
"walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)",

View file

@ -30,4 +30,4 @@ grin_util = { path = "../util", version = "1.1.0-beta.2" }
[dev-dependencies]
env_logger = "0.5"
rand = "0.5"
rand = "0.6"

View file

@ -10,7 +10,7 @@ workspace = ".."
edition = "2018"
[dependencies]
rand = "0.5"
rand = "0.6"
serde = "1"
serde_derive = "1"
toml = "0.4"

View file

@ -20,7 +20,7 @@ lazy_static = "1"
lru-cache = "0.1"
num = "0.2"
num-bigint = "0.2"
rand = "0.5"
rand = "0.6"
serde = "1"
serde_derive = "1"
siphasher = "0.2"

View file

@ -12,7 +12,7 @@ edition = "2018"
[dependencies]
byteorder = "1"
blake2-rfc = "0.2"
rand = "0.5"
rand = "0.6"
log = "0.4"
serde = "1"
serde_derive = "1"

View file

@ -15,7 +15,7 @@ bytes = "0.4"
enum_primitive = "0.1"
net2 = "0.2"
num = "0.1"
rand = "0.5"
rand = "0.6"
serde = "1"
serde_derive = "1"
log = "0.4"
@ -28,4 +28,3 @@ grin_chain = { path = "../chain", version = "1.1.0-beta.2" }
[dev-dependencies]
grin_pool = { path = "../pool", version = "1.1.0-beta.2" }

View file

@ -18,7 +18,8 @@ use std::fs::File;
use std::path::PathBuf;
use std::sync::Arc;
use rand::{thread_rng, Rng};
use rand::seq::SliceRandom;
use rand::thread_rng;
use crate::chain;
use crate::core::core;
@ -100,7 +101,7 @@ impl Peers {
.filter(|p| p.is_connected())
.cloned()
.collect::<Vec<_>>();
thread_rng().shuffle(&mut res);
res.shuffle(&mut thread_rng());
res
}
@ -141,7 +142,7 @@ impl Peers {
.filter(|x| x.info.total_difficulty() > total_difficulty)
.collect::<Vec<_>>();
thread_rng().shuffle(&mut max_peers);
max_peers.shuffle(&mut thread_rng());
Ok(max_peers)
}
@ -190,7 +191,7 @@ impl Peers {
.filter(|x| x.info.total_difficulty() == max_total_difficulty)
.collect::<Vec<_>>();
thread_rng().shuffle(&mut max_peers);
max_peers.shuffle(&mut thread_rng());
max_peers
}

View file

@ -16,7 +16,8 @@
use chrono::Utc;
use num::FromPrimitive;
use rand::{thread_rng, Rng};
use rand::seq::SliceRandom;
use rand::thread_rng;
use crate::core::ser::{self, Readable, Reader, Writeable, Writer};
use crate::types::{Capabilities, PeerAddr, ReasonForBan};
@ -158,7 +159,7 @@ impl PeerStore {
.map(|(_, v)| v)
.filter(|p| p.flags == state && p.capabilities.contains(cap))
.collect::<Vec<_>>();
thread_rng().shuffle(&mut peers[..]);
peers[..].shuffle(&mut thread_rng());
Ok(peers.iter().take(count).cloned().collect())
}

View file

@ -11,7 +11,7 @@ edition = "2018"
[dependencies]
blake2-rfc = "0.2"
rand = "0.5"
rand = "0.6"
serde = "1"
serde_derive = "1"
log = "0.4"

View file

@ -17,7 +17,7 @@ futures = "0.1"
http = "0.1"
itertools = "0.7"
lmdb-zero = "0.4.4"
rand = "0.5"
rand = "0.6"
serde = "1"
log = "0.4"
serde_derive = "1"

View file

@ -19,7 +19,8 @@
use chrono::prelude::{DateTime, Utc};
use chrono::{Duration, MIN_DATE};
use rand::{thread_rng, Rng};
use rand::seq::SliceRandom;
use rand::thread_rng;
use std::collections::HashMap;
use std::net::ToSocketAddrs;
use std::sync::{mpsc, Arc};
@ -221,7 +222,7 @@ fn monitor_peers(
// take a random defunct peer and mark it healthy: over a long period any
// peer will see another as defunct eventually, gives us a chance to retry
if defuncts.len() > 0 {
thread_rng().shuffle(&mut defuncts);
defuncts.shuffle(&mut thread_rng());
let _ = peers.update_state(defuncts[0].addr, p2p::State::Healthy);
}

View file

@ -27,5 +27,5 @@ grin_util = { path = "../util", version = "1.1.0-beta.2" }
[dev-dependencies]
chrono = "0.4.4"
rand = "0.5"
rand = "0.6"
filetime = "0.2"

View file

@ -14,7 +14,7 @@ backtrace = "0.3"
base64 = "0.9"
byteorder = "1"
lazy_static = "1"
rand = "0.5"
rand = "0.6"
serde = "1"
serde_derive = "1"
log4rs = { version = "0.8.1", features = ["rolling_file_appender", "compound_policy", "size_trigger", "fixed_window_roller"] }