diff options
author | Aaron Loucks <[email protected]> | 2020-06-03 12:26:15 +0100 |
---|---|---|
committer | Aaron Loucks <[email protected]> | 2020-06-03 12:26:15 +0100 |
commit | f06b2bcd91329fb795839a4eabd8f43aa472aeb2 (patch) | |
tree | 9642c029da5dc0bd44b36087464e2407062bf040 /crates/stdx/src | |
parent | 1211a46826ee8a08683e4cfe151649efd6fd90fa (diff) |
Use split1 when formatting function signature params
Diffstat (limited to 'crates/stdx/src')
-rw-r--r-- | crates/stdx/src/lib.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/crates/stdx/src/lib.rs b/crates/stdx/src/lib.rs index 71a57fba2..c0356344c 100644 --- a/crates/stdx/src/lib.rs +++ b/crates/stdx/src/lib.rs | |||
@@ -124,3 +124,8 @@ pub fn replace(buf: &mut String, from: char, to: &str) { | |||
124 | // FIXME: do this in place. | 124 | // FIXME: do this in place. |
125 | *buf = buf.replace(from, to) | 125 | *buf = buf.replace(from, to) |
126 | } | 126 | } |
127 | |||
128 | pub fn split1(haystack: &str, delim: char) -> Option<(&str, &str)> { | ||
129 | let idx = haystack.find(delim)?; | ||
130 | Some((&haystack[..idx], &haystack[idx + delim.len_utf8()..])) | ||
131 | } | ||