summary refs log tree commit diff
path: root/src/tools/rust-analyzer/crates/base-db
diff options
context:
space:
mode:
authorLukas Wirth <lukastw97@gmail.com>2024-08-07 14:27:59 +0200
committerLukas Wirth <lukastw97@gmail.com>2024-08-07 14:27:59 +0200
commitdbf2c126a30508fabb75eb03c8147efccd3ba11d (patch)
tree37d3e8ee177d9ad3c276179e09e22030e3c3a83c /src/tools/rust-analyzer/crates/base-db
parent0713a4704508c86ff223910a415829e08031ae64 (diff)
downloadrust-dbf2c126a30508fabb75eb03c8147efccd3ba11d.tar.gz
rust-dbf2c126a30508fabb75eb03c8147efccd3ba11d.zip
Remove unnecessary CfgFlag definition in project-model
Diffstat (limited to 'src/tools/rust-analyzer/crates/base-db')
-rw-r--r--src/tools/rust-analyzer/crates/base-db/src/input.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/tools/rust-analyzer/crates/base-db/src/input.rs b/src/tools/rust-analyzer/crates/base-db/src/input.rs
index 460581f4a6c..3616fa9fd86 100644
--- a/src/tools/rust-analyzer/crates/base-db/src/input.rs
+++ b/src/tools/rust-analyzer/crates/base-db/src/input.rs
@@ -690,6 +690,14 @@ impl Env {
     pub fn extend_from_other(&mut self, other: &Env) {
         self.entries.extend(other.entries.iter().map(|(x, y)| (x.to_owned(), y.to_owned())));
     }
+
+    pub fn is_empty(&self) -> bool {
+        self.entries.is_empty()
+    }
+
+    pub fn insert(&mut self, k: impl Into<String>, v: impl Into<String>) -> Option<String> {
+        self.entries.insert(k.into(), v.into())
+    }
 }
 
 impl From<Env> for Vec<(String, String)> {
@@ -700,6 +708,15 @@ impl From<Env> for Vec<(String, String)> {
     }
 }
 
+impl<'a> IntoIterator for &'a Env {
+    type Item = (&'a String, &'a String);
+    type IntoIter = std::collections::hash_map::Iter<'a, String, String>;
+
+    fn into_iter(self) -> Self::IntoIter {
+        self.entries.iter()
+    }
+}
+
 #[derive(Debug)]
 pub struct CyclicDependenciesError {
     path: Vec<(CrateId, Option<CrateDisplayName>)>,