mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-26 11:59:49 +00:00
Use split1 when formatting function signature params
This commit is contained in:
parent
1211a46826
commit
f06b2bcd91
5 changed files with 12 additions and 11 deletions
|
@ -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()..]))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue