From 752817e20d48dfa515556c77428111e332ae4733 Mon Sep 17 00:00:00 2001 From: Martin Habovstiak Date: Wed, 22 Feb 2023 01:09:01 +0100 Subject: [PATCH] Stop using `$len` in `hash_newtype` We want to get rid of this argument since its value is implied by the inner hash type. First we stop using it. --- hashes/src/util.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hashes/src/util.rs b/hashes/src/util.rs index ca007300..d9354d1a 100644 --- a/hashes/src/util.rs +++ b/hashes/src/util.rs @@ -122,7 +122,7 @@ macro_rules! hash_newtype { pub struct $newtype($hash); $crate::hex_fmt_impl!($reverse, $newtype); - $crate::serde_impl!($newtype, $len); + $crate::serde_impl!($newtype, <$newtype as $crate::Hash>::LEN); $crate::borrow_slice_impl!($newtype); impl $newtype { @@ -208,9 +208,9 @@ macro_rules! hash_newtype { } } - impl $crate::_export::_core::convert::AsRef<[u8; $len]> for $newtype { - fn as_ref(&self) -> &[u8; $len] { - AsRef::<[u8; $len]>::as_ref(&self.0) + impl $crate::_export::_core::convert::AsRef<[u8; <$hash as $crate::Hash>::LEN]> for $newtype { + fn as_ref(&self) -> &[u8; <$hash as $crate::Hash>::LEN] { + AsRef::<[u8; <$hash as $crate::Hash>::LEN]>::as_ref(&self.0) } }