aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def/src
diff options
context:
space:
mode:
authorJonas Schievink <[email protected]>2020-06-30 12:54:40 +0100
committerJonas Schievink <[email protected]>2020-06-30 12:54:40 +0100
commita80e8fea858ff789ed9fc490c2c1eb2b4eed6e82 (patch)
tree0e638c07990573a2c895992509fed2e2ab000dc8 /crates/ra_hir_def/src
parent56fb8a401ad38e766030755a19115251e66aafd6 (diff)
Simplify entry API usage
Diffstat (limited to 'crates/ra_hir_def/src')
-rw-r--r--crates/ra_hir_def/src/item_scope.rs33
1 files changed, 12 insertions, 21 deletions
diff --git a/crates/ra_hir_def/src/item_scope.rs b/crates/ra_hir_def/src/item_scope.rs
index f36477c03..c8dde6f8d 100644
--- a/crates/ra_hir_def/src/item_scope.rs
+++ b/crates/ra_hir_def/src/item_scope.rs
@@ -158,31 +158,22 @@ impl ItemScope {
158 let mut changed = false; 158 let mut changed = false;
159 159
160 if let Some(types) = def.types { 160 if let Some(types) = def.types {
161 match self.types.entry(name.clone()) { 161 self.types.entry(name.clone()).or_insert_with(|| {
162 Entry::Occupied(_) => {} 162 changed = true;
163 Entry::Vacant(e) => { 163 types
164 e.insert(types); 164 });
165 changed = true;
166 }
167 }
168 } 165 }
169 if let Some(values) = def.values { 166 if let Some(values) = def.values {
170 match self.values.entry(name.clone()) { 167 self.values.entry(name.clone()).or_insert_with(|| {
171 Entry::Occupied(_) => {} 168 changed = true;
172 Entry::Vacant(e) => { 169 values
173 e.insert(values); 170 });
174 changed = true;
175 }
176 }
177 } 171 }
178 if let Some(macros) = def.macros { 172 if let Some(macros) = def.macros {
179 match self.macros.entry(name.clone()) { 173 self.macros.entry(name.clone()).or_insert_with(|| {
180 Entry::Occupied(_) => {} 174 changed = true;
181 Entry::Vacant(e) => { 175 macros
182 e.insert(macros); 176 });
183 changed = true;
184 }
185 }
186 } 177 }
187 178
188 if def.is_none() { 179 if def.is_none() {