Skip to content

Commit 6cec5e7

Browse files
committed
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.
1 parent 3f02ac0 commit 6cec5e7

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/lib.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ use core::{fmt, mem, str};
175175

176176
#[cfg(feature = "global-context")]
177177
pub use context::global::SECP256K1;
178+
#[cfg(feature = "hashes")]
179+
use hashes::Hash;
178180
#[cfg(feature = "rand")]
179181
pub use rand;
180182
pub use secp256k1_sys as ffi;
@@ -184,8 +186,6 @@ pub use serde;
184186
pub use crate::context::*;
185187
use crate::ffi::types::AlignedType;
186188
use crate::ffi::CPtr;
187-
#[cfg(feature = "hashes")]
188-
use crate::hashes::Hash;
189189
pub use crate::key::{PublicKey, SecretKey, *};
190190
pub use crate::scalar::Scalar;
191191

@@ -1046,16 +1046,16 @@ mod tests {
10461046
#[cfg(feature = "hashes")]
10471047
#[test]
10481048
fn test_from_hash() {
1049-
use crate::hashes::{self, Hash};
1049+
use hashes::{sha256, sha256d, Hash};
10501050

10511051
let test_bytes = "Hello world!".as_bytes();
10521052

1053-
let hash = hashes::sha256::Hash::hash(test_bytes);
1053+
let hash = sha256::Hash::hash(test_bytes);
10541054
let msg = Message::from(hash);
10551055
assert_eq!(msg.0, hash.to_byte_array());
10561056
assert_eq!(msg, Message::from_hashed_data::<hashes::sha256::Hash>(test_bytes));
10571057

1058-
let hash = hashes::sha256d::Hash::hash(test_bytes);
1058+
let hash = sha256d::Hash::hash(test_bytes);
10591059
let msg = Message::from(hash);
10601060
assert_eq!(msg.0, hash.to_byte_array());
10611061
assert_eq!(msg, Message::from_hashed_data::<hashes::sha256d::Hash>(test_bytes));

src/secret.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ macro_rules! impl_display_secret {
3535
#[cfg(all(not(feature = "std"), feature = "hashes"))]
3636
impl ::core::fmt::Debug for $thing {
3737
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
38-
use crate::hashes::{sha256, Hash, HashEngine};
38+
use hashes::{sha256, Hash, HashEngine};
3939

4040
let tag = "rust-secp256k1DEBUG";
4141

0 commit comments

Comments
 (0)