Skip to content

Commit

Permalink
fix host logging
Browse files Browse the repository at this point in the history
  • Loading branch information
amiremohamadi committed Mar 23, 2024
1 parent 1ba50e5 commit 80866ed
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,19 @@ pub(crate) struct Addr<'a> {

impl<'a> fmt::Debug for Addr<'a> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let mut addr = vec![];
let mut addr = String::new();

if let Some(host) = self.host {
addr.extend_from_slice(host);
let host = String::from_utf8_lossy(host);
addr.push_str(&host);
}

if let Some(port) = self.port {
addr.extend_from_slice(b":");
addr.extend_from_slice(&port.to_string().as_bytes());
let port = format!(":{}", port);
addr.push_str(&port);
}

write!(f, "{:?}", addr)
write!(f, "{}", addr)
}
}

Expand Down

0 comments on commit 80866ed

Please sign in to comment.