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:
parent
3629421e17
commit
4701ea0c95
1 changed files with 1 additions and 5 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue