Merge rust-bitcoin/rust-bitcoin#3314: hashes: Use $crate in internal macros

d72f730211 hashes: Use $crate in internal macros (Tobin C. Harding)

Pull request description:

  These are only called from within the crate but it is still more correct to use `$crate` and saves this from biting us later if we copy the code someplace else.

  Internal change only.

ACKs for top commit:
  Kixunil:
    ACK d72f730211
  apoelstra:
    ACK d72f730211 successfully ran local tests

Tree-SHA512: d278643c3fbeb28ca377ebf59958054dd2893c46b48469e03a8c7517c5b0b33271de061ae662c400d45962724fe4d13cada41fd5b839a1ff784521ac69c9db72
This commit is contained in:
merge-script 2024-09-07 13:40:04 +00:00
commit 2c26dc4e57
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
1 changed files with 6 additions and 6 deletions

View File

@ -99,13 +99,13 @@ macro_rules! hash_trait_impls {
}
}
impl<$($gen: $gent),*> crate::GeneralHash for Hash<$($gen),*> {
impl<$($gen: $gent),*> $crate::GeneralHash for Hash<$($gen),*> {
type Engine = HashEngine;
fn from_engine(e: HashEngine) -> Hash<$($gen),*> { Self::from_engine(e) }
}
impl<$($gen: $gent),*> crate::Hash for Hash<$($gen),*> {
impl<$($gen: $gent),*> $crate::Hash for Hash<$($gen),*> {
type Bytes = [u8; $bits / 8];
const DISPLAY_BACKWARD: bool = $reverse;
@ -148,7 +148,7 @@ macro_rules! hash_type {
/// Hashes some bytes.
#[allow(clippy::self_named_constructors)] // Hash is a noun and a verb.
pub fn hash(data: &[u8]) -> Self { <Self as crate::GeneralHash>::hash(data) }
pub fn hash(data: &[u8]) -> Self { <Self as $crate::GeneralHash>::hash(data) }
/// Hashes all the byte slices retrieved from the iterator together.
pub fn hash_byte_chunks<B, I>(byte_slices: I) -> Self
@ -156,13 +156,13 @@ macro_rules! hash_type {
B: AsRef<[u8]>,
I: IntoIterator<Item = B>,
{
<Self as crate::GeneralHash>::hash_byte_chunks(byte_slices)
<Self as $crate::GeneralHash>::hash_byte_chunks(byte_slices)
}
/// Hashes the entire contents of the `reader`.
#[cfg(feature = "bitcoin-io")]
pub fn hash_reader<R: io::BufRead>(reader: &mut R) -> Result<Self, io::Error> {
<Self as crate::GeneralHash>::hash_reader(reader)
<Self as $crate::GeneralHash>::hash_reader(reader)
}
}
};
@ -245,7 +245,7 @@ macro_rules! hash_type_no_default {
}
}
crate::internal_macros::hash_trait_impls!($bits, $reverse);
$crate::internal_macros::hash_trait_impls!($bits, $reverse);
};
}
pub(crate) use hash_type_no_default;