1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-27 19:17:43 +00:00

uucore: use split_once in canon_host

This commit is contained in:
Terts Diepraam 2022-04-01 18:46:12 +02:00 committed by Sylvestre Ledru
parent 3629421e17
commit 4701ea0c95

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;