aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_db
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_db')
-rw-r--r--crates/ra_db/src/fixture.rs10
-rw-r--r--crates/ra_db/src/input.rs15
2 files changed, 17 insertions, 8 deletions
diff --git a/crates/ra_db/src/fixture.rs b/crates/ra_db/src/fixture.rs
index 8b62fe9aa..fd535ab15 100644
--- a/crates/ra_db/src/fixture.rs
+++ b/crates/ra_db/src/fixture.rs
@@ -254,20 +254,14 @@ impl From<&FixtureMeta> for ParsedMeta {
254 } 254 }
255 FixtureMeta::File(f) => Self::File(FileMeta { 255 FixtureMeta::File(f) => Self::File(FileMeta {
256 path: f.path.to_owned().into(), 256 path: f.path.to_owned().into(),
257 krate: f.krate.to_owned().into(), 257 krate: f.crate_name.to_owned().into(),
258 deps: f.deps.to_owned(), 258 deps: f.deps.to_owned(),
259 cfg: f.cfg.to_owned(), 259 cfg: f.cfg.to_owned(),
260 edition: f 260 edition: f
261 .edition 261 .edition
262 .as_ref() 262 .as_ref()
263 .map_or(Edition::Edition2018, |v| Edition::from_str(&v).unwrap()), 263 .map_or(Edition::Edition2018, |v| Edition::from_str(&v).unwrap()),
264 env: { 264 env: Env::from(f.env.iter()),
265 let mut env = Env::default();
266 for (k, v) in &f.env {
267 env.set(&k, v.to_owned());
268 }
269 env
270 },
271 }), 265 }),
272 } 266 }
273 } 267 }
diff --git a/crates/ra_db/src/input.rs b/crates/ra_db/src/input.rs
index ab14e2d5e..4d2d3b48a 100644
--- a/crates/ra_db/src/input.rs
+++ b/crates/ra_db/src/input.rs
@@ -311,6 +311,21 @@ impl fmt::Display for Edition {
311 } 311 }
312} 312}
313 313
314impl<'a, T> From<T> for Env
315where
316 T: Iterator<Item = (&'a String, &'a String)>,
317{
318 fn from(iter: T) -> Self {
319 let mut result = Self::default();
320
321 for (k, v) in iter {
322 result.entries.insert(k.to_owned(), v.to_owned());
323 }
324
325 result
326 }
327}
328
314impl Env { 329impl Env {
315 pub fn set(&mut self, env: &str, value: String) { 330 pub fn set(&mut self, env: &str, value: String) {
316 self.entries.insert(env.to_owned(), value); 331 self.entries.insert(env.to_owned(), value);