do not use str.split_once, as it is not in MSRV

This commit is contained in:
Dustin J. Mitchell 2021-12-27 00:14:40 +00:00
parent e94c29ae2f
commit bc8bb52551

View file

@ -61,10 +61,13 @@ enum Prop {
#[allow(clippy::ptr_arg)]
fn uda_string_to_tuple(key: &str) -> (&str, &str) {
if let Some((ns, key)) = key.split_once('.') {
(ns, key)
let mut iter = key.splitn(2, '.');
let first = iter.next().unwrap();
let second = iter.next();
if let Some(second) = second {
(first, second)
} else {
("", key)
("", first)
}
}