hashes: Use $crate in macro
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.
This commit is contained in:
parent
6c8f759676
commit
360d1fb1bb
|
@ -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