diff options
author | Aleksey Kladov <[email protected]> | 2020-07-30 21:19:58 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-07-30 21:23:12 +0100 |
commit | be49547b446cba240f8f2a9592284e77d4a6896f (patch) | |
tree | de01434050b1fb9437dd519ca0d65229d52156a3 /crates/test_utils/src | |
parent | 239dd506f68db0cbe4417b6e5c7f737d8ff8a159 (diff) |
Use split_once polyfill
Diffstat (limited to 'crates/test_utils/src')
-rw-r--r-- | crates/test_utils/src/fixture.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/crates/test_utils/src/fixture.rs b/crates/test_utils/src/fixture.rs index ed764046b..e40b61a94 100644 --- a/crates/test_utils/src/fixture.rs +++ b/crates/test_utils/src/fixture.rs | |||
@@ -2,7 +2,7 @@ | |||
2 | //! rust-analyzer database from a single string. | 2 | //! rust-analyzer database from a single string. |
3 | 3 | ||
4 | use rustc_hash::FxHashMap; | 4 | use rustc_hash::FxHashMap; |
5 | use stdx::{lines_with_ends, split_delim, trim_indent}; | 5 | use stdx::{lines_with_ends, split_once, trim_indent}; |
6 | 6 | ||
7 | #[derive(Debug, Eq, PartialEq)] | 7 | #[derive(Debug, Eq, PartialEq)] |
8 | pub struct Fixture { | 8 | pub struct Fixture { |
@@ -71,14 +71,14 @@ impl Fixture { | |||
71 | let mut cfg_key_values = Vec::new(); | 71 | let mut cfg_key_values = Vec::new(); |
72 | let mut env = FxHashMap::default(); | 72 | let mut env = FxHashMap::default(); |
73 | for component in components[1..].iter() { | 73 | for component in components[1..].iter() { |
74 | let (key, value) = split_delim(component, ':').unwrap(); | 74 | let (key, value) = split_once(component, ':').unwrap(); |
75 | match key { | 75 | match key { |
76 | "crate" => krate = Some(value.to_string()), | 76 | "crate" => krate = Some(value.to_string()), |
77 | "deps" => deps = value.split(',').map(|it| it.to_string()).collect(), | 77 | "deps" => deps = value.split(',').map(|it| it.to_string()).collect(), |
78 | "edition" => edition = Some(value.to_string()), | 78 | "edition" => edition = Some(value.to_string()), |
79 | "cfg" => { | 79 | "cfg" => { |
80 | for entry in value.split(',') { | 80 | for entry in value.split(',') { |
81 | match split_delim(entry, '=') { | 81 | match split_once(entry, '=') { |
82 | Some((k, v)) => cfg_key_values.push((k.to_string(), v.to_string())), | 82 | Some((k, v)) => cfg_key_values.push((k.to_string(), v.to_string())), |
83 | None => cfg_atoms.push(entry.to_string()), | 83 | None => cfg_atoms.push(entry.to_string()), |
84 | } | 84 | } |
@@ -86,7 +86,7 @@ impl Fixture { | |||
86 | } | 86 | } |
87 | "env" => { | 87 | "env" => { |
88 | for key in value.split(',') { | 88 | for key in value.split(',') { |
89 | if let Some((k, v)) = split_delim(key, '=') { | 89 | if let Some((k, v)) = split_once(key, '=') { |
90 | env.insert(k.into(), v.into()); | 90 | env.insert(k.into(), v.into()); |
91 | } | 91 | } |
92 | } | 92 | } |