Use split1 when formatting function signature params

This commit is contained in:
Aaron Loucks 2020-06-03 07:26:15 -04:00
parent 1211a46826
commit f06b2bcd91
5 changed files with 12 additions and 11 deletions

View file

@ -124,3 +124,8 @@ pub fn replace(buf: &mut String, from: char, to: &str) {
// FIXME: do this in place.
*buf = buf.replace(from, to)
}
pub fn split1(haystack: &str, delim: char) -> Option<(&str, &str)> {
let idx = haystack.find(delim)?;
Some((&haystack[..idx], &haystack[idx + delim.len_utf8()..]))
}