Skip to content

Commit a766381

Browse files
Hyunsik Jeongsgkim126
authored andcommitted
Update rand from 0.5.3 to 0.6.1
1 parent feb028b commit a766381

File tree

19 files changed

+128
-46
lines changed

19 files changed

+128
-46
lines changed

Cargo.lock

Lines changed: 99 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ memorydb = { path = "../util/memorydb" }
3232
multimap = { path = "../util/multimap" }
3333
parking_lot = "0.6.0"
3434
primitives = { path = "../util/primitives" }
35-
rand = "0.5.3"
35+
rand = "0.6.1"
3636
rlp = { path = "../util/rlp" }
3737
rlp_compress = { path = "../util/rlp_compress" }
3838
rlp_derive = { path = "../util/rlp_derive" }

core/src/consensus/tendermint/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ use ctypes::util::unexpected::{Mismatch, OutOfBounds};
3131
use ctypes::BlockNumber;
3232
use parking_lot::{Mutex, ReentrantMutex, RwLock};
3333
use primitives::{u256_from_u128, Bytes, H256, U256};
34-
use rand::{thread_rng, Rng};
34+
use rand::prelude::SliceRandom;
35+
use rand::thread_rng;
3536
use rlp::{Encodable, UntrustedRlp};
3637
use time::Duration;
3738

@@ -995,7 +996,7 @@ impl TendermintExtension {
995996
let mut count = (peers.len() as f64).powf(0.5).round() as usize;
996997
count = cmp::min(count, MAX_PEERS_PROPAGATION);
997998
count = cmp::max(count, MIN_PEERS_PROPAGATION);
998-
thread_rng().shuffle(&mut peers);
999+
peers.shuffle(&mut thread_rng());
9991000
peers.truncate(count);
10001001
peers
10011002
}

crypto/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ rust-crypto = "0.2.36"
1010
primitives = { path = "../util/primitives" }
1111

1212
[dev-dependencies]
13-
rand = "0.5.3"
13+
rand = "0.6.1"

discovery/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ codechain-network = { path = "../network" }
1111
log = "0.4.6"
1212
parking_lot = "0.6.0"
1313
primitives = { path = "../util/primitives" }
14-
rand = "0.5.3"
14+
rand = "0.6.1"
1515
rlp = { path = "../util/rlp" }
1616
time = "0.1"
1717

discovery/src/unstructured/extension.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ use std::sync::Arc;
1919

2020
use cnetwork::{Api, DiscoveryApi, IntoSocketAddr, NetworkExtension, NodeId, RoutingTable, TimeoutHandler, TimerToken};
2121
use parking_lot::RwLock;
22-
use rand::{thread_rng, Rng};
22+
use rand::prelude::SliceRandom;
23+
use rand::thread_rng;
2324
use rlp::{Decodable, Encodable, UntrustedRlp};
2425
use time::Duration;
2526

@@ -99,7 +100,7 @@ impl NetworkExtension for Extension {
99100
if let (Some(api), Some(routing_table)) = (&*api, &*routing_table) {
100101
let mut addresses =
101102
routing_table.reachable_addresses(&node.into_addr()).into_iter().collect::<Vec<_>>();
102-
thread_rng().shuffle(&mut addresses);
103+
addresses.shuffle(&mut thread_rng());
103104
let addresses =
104105
addresses.into_iter().take(::std::cmp::min(self.config.bucket_size, len) as usize).collect();
105106
let response = Message::Response(addresses).rlp_bytes();

key/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version = "0.1.0"
44
authors = ["debris <[email protected]>", "CodeChain Team <[email protected]>"]
55

66
[dependencies]
7-
rand = "0.5.3"
7+
rand = "0.6.1"
88
rustc-hex = "1.0"
99
rustc-serialize = "0.3"
1010
lazy_static = "1.2"

key/src/random.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// along with this program. If not, see <https://www.gnu.org/licenses/>.
1616

1717
use crate::{Generator, KeyPair, SECP256K1};
18-
use rand::os::OsRng;
18+
use rand::rngs::OsRng;
1919

2020
pub struct Random;
2121

keystore/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ authors = ["CodeChain Team <[email protected]>", "Parity Technologies <admin@
66
[dependencies]
77
log = "0.4.6"
88
libc = "0.2"
9-
rand = "0.5.3"
9+
rand = "0.6.1"
1010
codechain-json = { path = "../json" }
1111
codechain-key = { path = "../key" }
1212
codechain-types = { path = "../types" }

keystore/src/random.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
1616

1717
use rand::distributions::Alphanumeric;
18-
use rand::{OsRng, Rng, RngCore};
18+
use rand::rngs::OsRng;
19+
use rand::{Rng, RngCore};
1920

2021
pub trait Random {
2122
fn random() -> Self

0 commit comments

Comments
 (0)