From 94fba3aa88944cc54ac1e722a93ef9915438f36e Mon Sep 17 00:00:00 2001 From: Jonas Nick Date: Fri, 7 Jun 2019 13:04:19 +0000 Subject: [PATCH] Remove unused rand dependency --- Cargo.toml | 1 - src/internal_macros.rs | 7 ------- src/lib.rs | 1 - src/util/address.rs | 3 +-- src/util/contracthash.rs | 2 +- src/util/misc.rs | 2 +- 6 files changed, 3 insertions(+), 13 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ea6694d..f11226b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,7 +23,6 @@ use-serde = ["serde", "bitcoin_hashes/serde"] [dependencies] bitcoin-bech32 = "0.9.0" byteorder = "1.2" -rand = "0.3" bitcoin_hashes = "0.3" bitcoinconsensus = { version = "0.16", optional = true } diff --git a/src/internal_macros.rs b/src/internal_macros.rs index afa6b33..f891c46 100644 --- a/src/internal_macros.rs +++ b/src/internal_macros.rs @@ -154,13 +154,6 @@ macro_rules! impl_array_newtype { } } } - - impl ::rand::Rand for $thing { - #[inline] - fn rand(r: &mut R) -> $thing { - $thing(::rand::Rand::rand(r)) - } - } } } diff --git a/src/lib.rs b/src/lib.rs index 590c4c9..4b68016 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -46,7 +46,6 @@ extern crate bitcoin_bech32; extern crate bitcoin_hashes; extern crate byteorder; extern crate hex; -extern crate rand; extern crate secp256k1; #[cfg(feature = "serde")] extern crate serde; #[cfg(feature = "strason")] extern crate strason; diff --git a/src/util/address.rs b/src/util/address.rs index 16fb3e6..22e987f 100644 --- a/src/util/address.rs +++ b/src/util/address.rs @@ -18,7 +18,6 @@ //! # Example: creating a new address from a randomly-generated key pair //! //! ```rust -//! extern crate rand; //! extern crate secp256k1; //! extern crate bitcoin; //! @@ -26,7 +25,7 @@ //! use bitcoin::util::address::Address; //! use bitcoin::util::key; //! use secp256k1::Secp256k1; -//! use rand::thread_rng; +//! use secp256k1::rand::thread_rng; //! //! fn main() { //! // Generate random key pair diff --git a/src/util/contracthash.rs b/src/util/contracthash.rs index 33fa3ef..91feb56 100644 --- a/src/util/contracthash.rs +++ b/src/util/contracthash.rs @@ -284,7 +284,7 @@ pub fn untemplate(script: &script::Script) -> Result<(Template, Vec), mod tests { use secp256k1::Secp256k1; use hex::decode as hex_decode; - use rand::thread_rng; + use secp256k1::rand::thread_rng; use std::str::FromStr; use blockdata::script::Script; diff --git a/src/util/misc.rs b/src/util/misc.rs index cc6ff64..ddfb2c7 100644 --- a/src/util/misc.rs +++ b/src/util/misc.rs @@ -124,7 +124,7 @@ pub fn signed_msg_hash(msg: &str) -> sha256d::Hash { #[cfg(all(test, feature="unstable"))] mod benches { - use rand::{Rng, thread_rng}; + use secp256k1::rand::{Rng, thread_rng}; use super::hex_bytes; use test::Bencher;