Clean up hashes import statements

Now that we have `hashes` as the crate name of `bitcoin_hashes` we can
slightly clean up the import statements.

This is based on the convention we have to import things directly from
the crate if we depend on it and not from the crate level re-export.
This commit is contained in:
Tobin C. Harding 2023-07-14 14:19:20 +10:00
parent 6d7c653b64
commit 6fdd3b1da5
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
2 changed files with 6 additions and 6 deletions

View File

@ -175,6 +175,8 @@ use core::{fmt, mem, str};
#[cfg(feature = "global-context")] #[cfg(feature = "global-context")]
pub use context::global::SECP256K1; pub use context::global::SECP256K1;
#[cfg(feature = "hashes")]
use hashes::Hash;
#[cfg(feature = "rand")] #[cfg(feature = "rand")]
pub use rand; pub use rand;
pub use secp256k1_sys as ffi; pub use secp256k1_sys as ffi;
@ -184,8 +186,6 @@ pub use serde;
pub use crate::context::*; pub use crate::context::*;
use crate::ffi::types::AlignedType; use crate::ffi::types::AlignedType;
use crate::ffi::CPtr; use crate::ffi::CPtr;
#[cfg(feature = "hashes")]
use crate::hashes::Hash;
pub use crate::key::{PublicKey, SecretKey, *}; pub use crate::key::{PublicKey, SecretKey, *};
pub use crate::scalar::Scalar; pub use crate::scalar::Scalar;
@ -1046,16 +1046,16 @@ mod tests {
#[cfg(feature = "hashes")] #[cfg(feature = "hashes")]
#[test] #[test]
fn test_from_hash() { fn test_from_hash() {
use crate::hashes::{self, Hash}; use hashes::{sha256, sha256d, Hash};
let test_bytes = "Hello world!".as_bytes(); let test_bytes = "Hello world!".as_bytes();
let hash = hashes::sha256::Hash::hash(test_bytes); let hash = sha256::Hash::hash(test_bytes);
let msg = Message::from(hash); let msg = Message::from(hash);
assert_eq!(msg.0, hash.to_byte_array()); assert_eq!(msg.0, hash.to_byte_array());
assert_eq!(msg, Message::from_hashed_data::<hashes::sha256::Hash>(test_bytes)); assert_eq!(msg, Message::from_hashed_data::<hashes::sha256::Hash>(test_bytes));
let hash = hashes::sha256d::Hash::hash(test_bytes); let hash = sha256d::Hash::hash(test_bytes);
let msg = Message::from(hash); let msg = Message::from(hash);
assert_eq!(msg.0, hash.to_byte_array()); assert_eq!(msg.0, hash.to_byte_array());
assert_eq!(msg, Message::from_hashed_data::<hashes::sha256d::Hash>(test_bytes)); assert_eq!(msg, Message::from_hashed_data::<hashes::sha256d::Hash>(test_bytes));

View File

@ -35,7 +35,7 @@ macro_rules! impl_display_secret {
#[cfg(all(not(feature = "std"), feature = "hashes"))] #[cfg(all(not(feature = "std"), feature = "hashes"))]
impl ::core::fmt::Debug for $thing { impl ::core::fmt::Debug for $thing {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
use crate::hashes::{sha256, Hash, HashEngine}; use hashes::{sha256, Hash, HashEngine};
let tag = "rust-secp256k1DEBUG"; let tag = "rust-secp256k1DEBUG";