Skip to content

Commit

Permalink
fix: avoid allocations in Display and Debug of Multiaddr
Browse files Browse the repository at this point in the history
  • Loading branch information
hrxi authored Nov 21, 2023
1 parent 3c7e813 commit 38d3a57
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ impl Multiaddr {

impl fmt::Debug for Multiaddr {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.to_string().fmt(f)
fmt::Display::fmt(self, f)
}
}

Expand All @@ -235,7 +235,7 @@ impl fmt::Display for Multiaddr {
///
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
for s in self.iter() {
s.to_string().fmt(f)?;
s.fmt(f)?;
}
Ok(())
}
Expand Down

0 comments on commit 38d3a57

Please sign in to comment.