better debugging for accountid32 in debug build (#2990)

This commit is contained in:
PG Herveou
2024-01-19 21:54:39 +01:00
committed by GitHub
parent 4fb2a55904
commit f2336d32f2
+8 -6
View File
@@ -593,14 +593,16 @@ impl std::fmt::Display for AccountId32 {
}
impl sp_std::fmt::Debug for AccountId32 {
#[cfg(feature = "std")]
fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
let s = self.to_ss58check();
write!(f, "{} ({}...)", crate::hexdisplay::HexDisplay::from(&self.0), &s[0..8])
}
#[cfg(feature = "serde")]
{
let s = self.to_ss58check();
write!(f, "{} ({}...)", crate::hexdisplay::HexDisplay::from(&self.0), &s[0..8])?;
}
#[cfg(not(feature = "serde"))]
write!(f, "{}", crate::hexdisplay::HexDisplay::from(&self.0))?;
#[cfg(not(feature = "std"))]
fn fmt(&self, _: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
Ok(())
}
}