Skip to content

Commit c5279be

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 c74bce5 commit c5279be

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

@@ -1016,16 +1016,16 @@ mod tests {
10161016
#[cfg(feature = "hashes")]
10171017
#[test]
10181018
fn test_from_hash() {
1019-
use crate::hashes::{self, Hash};
1019+
use hashes::{sha256, sha256d, Hash};
10201020

10211021
let test_bytes = "Hello world!".as_bytes();
10221022

1023-
let hash = hashes::sha256::Hash::hash(test_bytes);
1023+
let hash = sha256::Hash::hash(test_bytes);
10241024
let msg = Message::from(hash);
10251025
assert_eq!(msg.0, hash.to_byte_array());
10261026
assert_eq!(msg, Message::from_hashed_data::<hashes::sha256::Hash>(test_bytes));
10271027

1028-
let hash = hashes::sha256d::Hash::hash(test_bytes);
1028+
let hash = sha256d::Hash::hash(test_bytes);
10291029
let msg = Message::from(hash);
10301030
assert_eq!(msg.0, hash.to_byte_array());
10311031
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)