uucore: use split_once in canon_host

This commit is contained in:
Terts Diepraam
2022-04-02 15:18:34 +02:00
committed by Sylvestre Ledru
parent 3629421e17
commit 4701ea0c95
+1 -5
View File
@@ -221,11 +221,7 @@ impl Utmpx {
pub fn canon_host(&self) -> IOResult<String> {
let host = self.host();
// TODO: change to use `split_once` when MSRV hits 1.52.0
// let (hostname, display) = host.split_once(':').unwrap_or((&host, ""));
let mut h = host.split(':');
let hostname = h.next().unwrap_or(&host);
let display = h.next().unwrap_or("");
let (hostname, display) = host.split_once(':').unwrap_or((&host, ""));
if !hostname.is_empty() {
extern crate dns_lookup;