diff --git a/fixed-hash/Cargo.toml b/fixed-hash/Cargo.toml index 1facbf088..8672c6d31 100644 --- a/fixed-hash/Cargo.toml +++ b/fixed-hash/Cargo.toml @@ -8,6 +8,7 @@ repository = "https://github.com/paritytech/parity-common" description = "Macros to define custom fixed-size hash types" documentation = "https://docs.rs/fixed-hash/" readme = "README.md" +edition = "2018" [package.metadata.docs.rs] features = ["quickcheck", "api-dummy"] @@ -15,9 +16,9 @@ features = ["quickcheck", "api-dummy"] [dependencies] rand = { version = "0.7", optional = true, default-features = false } rustc-hex = { version = "2.0", optional = true, default-features = false } -quickcheck = { version = "0.7", optional = true } +quickcheck = { version = "0.9", optional = true } byteorder = { version = "1.2", optional = true, default-features = false } -static_assertions = "0.2" +static_assertions = "0.3" [dev-dependencies] rand_xorshift = "0.2.0" diff --git a/fixed-hash/src/lib.rs b/fixed-hash/src/lib.rs index f215a771c..9c841f885 100644 --- a/fixed-hash/src/lib.rs +++ b/fixed-hash/src/lib.rs @@ -15,21 +15,20 @@ pub extern crate alloc as alloc_; // Re-export libcore using an alias so that the macros can work without -// requiring `extern crate core` downstream. +// requiring `use core` downstream. #[doc(hidden)] -pub extern crate core as core_; +pub use core as core_; #[cfg(all(feature = "libc", not(target_os = "unknown")))] #[doc(hidden)] -pub extern crate libc; +pub use libc; // This disables a warning for unused #[macro_use(..)] // which is incorrect since the compiler does not check // for all available configurations. #[allow(unused_imports)] -#[macro_use(const_assert)] #[doc(hidden)] -pub extern crate static_assertions; +pub use static_assertions; // Export `const_assert` macro so that users of this crate do not // have to import the `static_assertions` crate themselves. @@ -38,7 +37,7 @@ pub use static_assertions::const_assert; #[cfg(feature = "byteorder")] #[doc(hidden)] -pub extern crate byteorder; +pub use byteorder; #[cfg(not(feature = "libc"))] #[doc(hidden)] @@ -46,15 +45,15 @@ pub mod libc {} #[cfg(feature = "rustc-hex")] #[doc(hidden)] -pub extern crate rustc_hex; +pub use rustc_hex; #[cfg(feature = "rand")] #[doc(hidden)] -pub extern crate rand; +pub use rand; #[cfg(feature = "quickcheck")] #[doc(hidden)] -pub extern crate quickcheck; +pub use quickcheck; #[cfg(test)] extern crate rand_xorshift; diff --git a/fixed-hash/src/tests.rs b/fixed-hash/src/tests.rs index 45e22927a..b1445f3e4 100644 --- a/fixed-hash/src/tests.rs +++ b/fixed-hash/src/tests.rs @@ -250,30 +250,29 @@ mod from_low_u64 { #[cfg(feature = "rand")] mod rand { use super::*; - use rand::SeedableRng; - use rand_xorshift::XorShiftRng; + use ::rand::{SeedableRng, rngs::StdRng}; #[test] fn random() { - let default_seed = ::Seed::default(); - let mut rng = XorShiftRng::from_seed(default_seed); + let default_seed = ::Seed::default(); + let mut rng = StdRng::from_seed(default_seed); assert_eq!( H32::random_using(&mut rng), - H32::from([0x43, 0xCA, 0x64, 0xED]) + H32::from([0x76, 0xa0, 0x40, 0x53]) ); } #[test] fn randomize() { - let default_seed = ::Seed::default(); - let mut rng = XorShiftRng::from_seed(default_seed); + let default_seed = ::Seed::default(); + let mut rng = StdRng::from_seed(default_seed); assert_eq!( { let mut ret = H32::zero(); ret.randomize_using(&mut rng); ret }, - H32::from([0x43, 0xCA, 0x64, 0xED]) + H32::from([0x76, 0xa0, 0x40, 0x53]) ) } } @@ -284,7 +283,7 @@ mod from_str { #[test] fn valid() { - use core_::str::FromStr; + use crate::core_::str::FromStr; assert_eq!( H64::from_str("0123456789ABCDEF").unwrap(), @@ -294,19 +293,19 @@ mod from_str { #[test] fn empty_str() { - use core_::str::FromStr; + use crate::core_::str::FromStr; assert!(H64::from_str("").is_err()) } #[test] fn invalid_digits() { - use core_::str::FromStr; + use crate::core_::str::FromStr; assert!(H64::from_str("Hello, World!").is_err()) } #[test] fn too_many_digits() { - use core_::str::FromStr; + use crate::core_::str::FromStr; assert!(H64::from_str("0123456789ABCDEF0").is_err()) } }