Make Address::fmt prettier
This commit is contained in:
parent
91b05ddcf0
commit
0f49fb6c59
1 changed files with 3 additions and 3 deletions
|
@ -60,9 +60,9 @@ struct Address<'a> {
|
|||
|
||||
impl<'a> fmt::Display for Address<'a> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match self.ip.is_ipv4() {
|
||||
true => write!(f, "{} {}:{}", self.protocol, self.ip, self.port),
|
||||
false => write!(f, "{} [{}]:{}", self.protocol, self.ip, self.port)
|
||||
match self.ip {
|
||||
IpAddr::V4(ip) => write!(f, "{} {}:{}", self.protocol, ip, self.port),
|
||||
IpAddr::V6(ip) => write!(f, "{} [{}]:{}", self.protocol, ip, self.port)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue