Fix net.rs - rsplitn() returns a reverse iterator

This commit is contained in:
Eric Arellano 2020-12-07 15:29:51 -07:00
parent f68cc68e79
commit a3174de9ff

View File

@ -177,9 +177,8 @@ impl TryFrom<&str> for LookupHost {
}
// split the string by ':' and convert the second part to u16
let (port_str, host) = try_opt!(s.rsplit_once(':'), "invalid socket address");
let (host, port_str) = try_opt!(s.rsplit_once(':'), "invalid socket address");
let port: u16 = try_opt!(port_str.parse().ok(), "invalid port value");
(host, port).try_into()
}
}