aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src/item_scope.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_def/src/item_scope.rs')
-rw-r--r--crates/hir_def/src/item_scope.rs34
1 files changed, 1 insertions, 33 deletions
diff --git a/crates/hir_def/src/item_scope.rs b/crates/hir_def/src/item_scope.rs
index 4e5daa2ff..aafd73b60 100644
--- a/crates/hir_def/src/item_scope.rs
+++ b/crates/hir_def/src/item_scope.rs
@@ -9,7 +9,6 @@ use hir_expand::MacroDefKind;
9use once_cell::sync::Lazy; 9use once_cell::sync::Lazy;
10use rustc_hash::{FxHashMap, FxHashSet}; 10use rustc_hash::{FxHashMap, FxHashSet};
11use stdx::format_to; 11use stdx::format_to;
12use test_utils::mark;
13 12
14use crate::{ 13use crate::{
15 db::DefDatabase, per_ns::PerNs, visibility::Visibility, AdtId, BuiltinType, ImplId, 14 db::DefDatabase, per_ns::PerNs, visibility::Visibility, AdtId, BuiltinType, ImplId,
@@ -169,37 +168,6 @@ impl ItemScope {
169 self.unnamed_trait_imports.insert(tr, vis); 168 self.unnamed_trait_imports.insert(tr, vis);
170 } 169 }
171 170
172 pub(crate) fn push_res(&mut self, name: Name, def: PerNs) -> bool {
173 let mut changed = false;
174
175 if let Some(types) = def.types {
176 self.types.entry(name.clone()).or_insert_with(|| {
177 changed = true;
178 types
179 });
180 }
181 if let Some(values) = def.values {
182 self.values.entry(name.clone()).or_insert_with(|| {
183 changed = true;
184 values
185 });
186 }
187 if let Some(macros) = def.macros {
188 self.macros.entry(name.clone()).or_insert_with(|| {
189 changed = true;
190 macros
191 });
192 }
193
194 if def.is_none() {
195 if self.unresolved.insert(name) {
196 changed = true;
197 }
198 }
199
200 changed
201 }
202
203 pub(crate) fn push_res_with_import( 171 pub(crate) fn push_res_with_import(
204 &mut self, 172 &mut self,
205 glob_imports: &mut PerNsGlobImports, 173 glob_imports: &mut PerNsGlobImports,
@@ -237,7 +205,7 @@ impl ItemScope {
237 if $glob_imports.$field.contains(&$lookup) 205 if $glob_imports.$field.contains(&$lookup)
238 && matches!($def_import_type, ImportType::Named) => 206 && matches!($def_import_type, ImportType::Named) =>
239 { 207 {
240 mark::hit!(import_shadowed); 208 cov_mark::hit!(import_shadowed);
241 $glob_imports.$field.remove(&$lookup); 209 $glob_imports.$field.remove(&$lookup);
242 if let Some(fld) = $def.$field { 210 if let Some(fld) = $def.$field {
243 entry.insert(fld); 211 entry.insert(fld);