Skip to content

Commit

Permalink
Clean up hashes import statements
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tcharding committed Aug 14, 2023
1 parent 728a561 commit 834d9ea
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ use core::{fmt, mem, str};

#[cfg(feature = "global-context")]
pub use context::global::SECP256K1;
#[cfg(feature = "hashes")]
use hashes::Hash;
#[cfg(feature = "rand")]
pub use rand;
pub use secp256k1_sys as ffi;
Expand All @@ -184,8 +186,6 @@ pub use serde;
pub use crate::context::*;
use crate::ffi::types::AlignedType;
use crate::ffi::CPtr;
#[cfg(feature = "hashes")]
use crate::hashes::Hash;
pub use crate::key::{PublicKey, SecretKey, *};
pub use crate::scalar::Scalar;

Expand Down Expand Up @@ -1046,16 +1046,16 @@ mod tests {
#[cfg(feature = "hashes")]
#[test]
fn test_from_hash() {
use crate::hashes::{self, Hash};
use hashes::{sha256, sha256d, Hash};

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);
assert_eq!(msg.0, hash.to_byte_array());
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);
assert_eq!(msg.0, hash.to_byte_array());
assert_eq!(msg, Message::from_hashed_data::<hashes::sha256d::Hash>(test_bytes));
Expand Down
2 changes: 1 addition & 1 deletion src/secret.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ macro_rules! impl_display_secret {
#[cfg(all(not(feature = "std"), feature = "hashes"))]
impl ::core::fmt::Debug for $thing {
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";

Expand Down

0 comments on commit 834d9ea

Please sign in to comment.