diff options
author | Mikhail Rakhmanov <[email protected]> | 2020-06-03 18:26:01 +0100 |
---|---|---|
committer | Mikhail Rakhmanov <[email protected]> | 2020-06-03 18:26:01 +0100 |
commit | 6a0083a519680e8d16bde5d7c1940c8dd6d4e9d4 (patch) | |
tree | 2b377141d722257cfea18e74b955aea1a8f6cc1a /crates/stdx/src | |
parent | 1f7de306f547ecb394a34445fd6ac1d6bc8ab439 (diff) | |
parent | 794f6da821c5d6e2490b996baffe162e4753262d (diff) |
Merge branch 'master' into compute-lazy-assits
# Conflicts:
# crates/rust-analyzer/src/main_loop/handlers.rs
# crates/rust-analyzer/src/to_proto.rs
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 | } | ||