Merge rust-bitcoin/rust-bitcoin#3017: hashes: Use `$crate` in macro
360d1fb1bb
hashes: Use $crate in macro (Tobin C. Harding) Pull request description: Depending on types being in scope when calling macros is bad practice but we have mistakenly done so in `internal_macros` when using the `FromSliceError`. Use `$crate::FromSliceError` in the macro and remove import statements. ACKs for top commit: Kixunil: ACK360d1fb1bb
apoelstra: ACK360d1fb1bb
Tree-SHA512: e93264ed7313e6f128cc9a441f68100fe423263aa9677c194d768cf1b04058bfc840027540e1c9d82ff5e925ddc165f34b2c6926987f610caa1686ea27a955eb
This commit is contained in:
commit
2fcd65ad97
|
@ -10,7 +10,7 @@
|
|||
use core::ops::Index;
|
||||
use core::slice::SliceIndex;
|
||||
|
||||
use crate::{ripemd160, sha256, FromSliceError};
|
||||
use crate::{ripemd160, sha256};
|
||||
|
||||
crate::internal_macros::hash_type! {
|
||||
160,
|
||||
|
|
|
@ -113,7 +113,7 @@ macro_rules! hash_trait_impls {
|
|||
const LEN: usize = $bits / 8;
|
||||
const DISPLAY_BACKWARD: bool = $reverse;
|
||||
|
||||
fn from_slice(sl: &[u8]) -> $crate::_export::_core::result::Result<Hash<$($gen),*>, FromSliceError> {
|
||||
fn from_slice(sl: &[u8]) -> $crate::_export::_core::result::Result<Hash<$($gen),*>, $crate::FromSliceError> {
|
||||
Self::from_slice(sl)
|
||||
}
|
||||
|
||||
|
@ -174,9 +174,9 @@ macro_rules! hash_type {
|
|||
/// Copies a byte slice into a hash object.
|
||||
pub fn from_slice(
|
||||
sl: &[u8],
|
||||
) -> $crate::_export::_core::result::Result<Hash, FromSliceError> {
|
||||
) -> $crate::_export::_core::result::Result<Hash, $crate::FromSliceError> {
|
||||
if sl.len() != $bits / 8 {
|
||||
Err(FromSliceError { expected: $bits / 8, got: sl.len() })
|
||||
Err($crate::FromSliceError { expected: $bits / 8, got: sl.len() })
|
||||
} else {
|
||||
let mut ret = [0; $bits / 8];
|
||||
ret.copy_from_slice(sl);
|
||||
|
|
|
@ -6,7 +6,7 @@ use core::cmp;
|
|||
use core::ops::Index;
|
||||
use core::slice::SliceIndex;
|
||||
|
||||
use crate::{FromSliceError, HashEngine as _};
|
||||
use crate::HashEngine as _;
|
||||
|
||||
crate::internal_macros::hash_type! {
|
||||
160,
|
||||
|
|
|
@ -6,7 +6,7 @@ use core::cmp;
|
|||
use core::ops::Index;
|
||||
use core::slice::SliceIndex;
|
||||
|
||||
use crate::{FromSliceError, HashEngine as _};
|
||||
use crate::HashEngine as _;
|
||||
|
||||
crate::internal_macros::hash_type! {
|
||||
160,
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
use core::ops::Index;
|
||||
use core::slice::SliceIndex;
|
||||
|
||||
use crate::{sha256, FromSliceError};
|
||||
use crate::sha256;
|
||||
|
||||
crate::internal_macros::hash_type! {
|
||||
256,
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
use core::ops::Index;
|
||||
use core::slice::SliceIndex;
|
||||
|
||||
use crate::{sha512, FromSliceError};
|
||||
use crate::sha512;
|
||||
|
||||
crate::internal_macros::hash_type! {
|
||||
384,
|
||||
|
|
|
@ -6,7 +6,7 @@ use core::cmp;
|
|||
use core::ops::Index;
|
||||
use core::slice::SliceIndex;
|
||||
|
||||
use crate::{FromSliceError, HashEngine as _};
|
||||
use crate::HashEngine as _;
|
||||
|
||||
crate::internal_macros::hash_type! {
|
||||
512,
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
use core::ops::Index;
|
||||
use core::slice::SliceIndex;
|
||||
|
||||
use crate::{sha512, FromSliceError};
|
||||
use crate::sha512;
|
||||
|
||||
crate::internal_macros::hash_type! {
|
||||
256,
|
||||
|
|
|
@ -6,7 +6,7 @@ use core::ops::Index;
|
|||
use core::slice::SliceIndex;
|
||||
use core::{cmp, mem, ptr};
|
||||
|
||||
use crate::{FromSliceError, HashEngine as _};
|
||||
use crate::HashEngine as _;
|
||||
|
||||
crate::internal_macros::hash_type! {
|
||||
64,
|
||||
|
|
Loading…
Reference in New Issue