diff --git a/src/internal_macros.rs b/src/internal_macros.rs index f6029c9e..88a39705 100644 --- a/src/internal_macros.rs +++ b/src/internal_macros.rs @@ -95,17 +95,6 @@ macro_rules! impl_array_newtype { } } -/// Implements debug formatting for a given wrapper type -macro_rules! impl_array_newtype_show { - ($thing:ident) => { - impl ::std::fmt::Debug for $thing { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - write!(f, concat!(stringify!($thing), "({:?})"), &self[..]) - } - } - } -} - /// Implements standard indexing methods for a given wrapper type macro_rules! impl_index_newtype { ($thing:ident, $ty:ty) => { @@ -583,6 +572,12 @@ macro_rules! impl_bytes_newtype { } } + impl ::std::fmt::Debug for $t { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + fmt::LowerHex::fmt(self, f) + } + } + impl $crate::hashes::hex::FromHex for $t { fn from_byte_iter(iter: I) -> Result where I: ::std::iter::Iterator> + diff --git a/src/util/bip32.rs b/src/util/bip32.rs index c28d337a..46727377 100644 --- a/src/util/bip32.rs +++ b/src/util/bip32.rs @@ -33,14 +33,12 @@ use util::key::{self, PublicKey, PrivateKey}; #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct ChainCode([u8; 32]); impl_array_newtype!(ChainCode, u8, 32); -impl_array_newtype_show!(ChainCode); impl_bytes_newtype!(ChainCode, 32); /// A fingerprint #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct Fingerprint([u8; 4]); impl_array_newtype!(Fingerprint, u8, 4); -impl_array_newtype_show!(Fingerprint); impl_bytes_newtype!(Fingerprint, 4); impl Default for Fingerprint {