Skip to content

Commit 38d3a57

Browse files
authored
fix: avoid allocations in Display and Debug of Multiaddr
1 parent 3c7e813 commit 38d3a57

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ impl Multiaddr {
217217

218218
impl fmt::Debug for Multiaddr {
219219
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
220-
self.to_string().fmt(f)
220+
fmt::Display::fmt(self, f)
221221
}
222222
}
223223

@@ -235,7 +235,7 @@ impl fmt::Display for Multiaddr {
235235
///
236236
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
237237
for s in self.iter() {
238-
s.to_string().fmt(f)?;
238+
s.fmt(f)?;
239239
}
240240
Ok(())
241241
}

0 commit comments

Comments
 (0)