chore: remove unnecessary std::, reformat

feat/type-attributes
Tomáš Mládek 2023-08-01 21:59:23 +02:00
parent 8625b7f519
commit 66f0d8ee39
1 changed files with 6 additions and 10 deletions

View File

@ -46,7 +46,7 @@ pub type UpCid = cid::CidGeneric<256>;
impl Address { impl Address {
pub fn encode(&self) -> Result<Vec<u8>, UpEndError> { pub fn encode(&self) -> Result<Vec<u8>, UpEndError> {
let (codec, hash) = match self { let (codec, hash) = match self {
Self::Hash(hash) => (RAW, LargeMultihash::from(hash)), Self::Hash(hash) => (RAW, hash.into()),
Self::Uuid(uuid) => ( Self::Uuid(uuid) => (
UP_UUID, UP_UUID,
LargeMultihash::wrap(IDENTITY, uuid.as_bytes()).map_err(UpEndError::from_any)?, LargeMultihash::wrap(IDENTITY, uuid.as_bytes()).map_err(UpEndError::from_any)?,
@ -205,18 +205,14 @@ impl FromStr for Address {
} }
} }
impl std::fmt::Display for Address { impl fmt::Display for Address {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!( write!(f, "{}", b58_encode(self.encode().map_err(|_| fmt::Error)?))
f,
"{}",
b58_encode(self.encode().map_err(|_| std::fmt::Error)?)
)
} }
} }
impl std::fmt::Debug for Address { impl fmt::Debug for Address {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!( write!(
f, f,
"Address<{}>: {}", "Address<{}>: {}",