diff options
Diffstat (limited to 'crates/ra_hir_def/src/item_scope.rs')
-rw-r--r-- | crates/ra_hir_def/src/item_scope.rs | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/crates/ra_hir_def/src/item_scope.rs b/crates/ra_hir_def/src/item_scope.rs index b5c07ed5f..81089554f 100644 --- a/crates/ra_hir_def/src/item_scope.rs +++ b/crates/ra_hir_def/src/item_scope.rs | |||
@@ -30,9 +30,7 @@ pub struct ItemScope { | |||
30 | static BUILTIN_SCOPE: Lazy<FxHashMap<Name, Resolution>> = Lazy::new(|| { | 30 | static BUILTIN_SCOPE: Lazy<FxHashMap<Name, Resolution>> = Lazy::new(|| { |
31 | BuiltinType::ALL | 31 | BuiltinType::ALL |
32 | .iter() | 32 | .iter() |
33 | .map(|(name, ty)| { | 33 | .map(|(name, ty)| (name.clone(), Resolution { def: PerNs::types(ty.clone().into()) })) |
34 | (name.clone(), Resolution { def: PerNs::types(ty.clone().into()), import: false }) | ||
35 | }) | ||
36 | .collect() | 34 | .collect() |
37 | }); | 35 | }); |
38 | 36 | ||
@@ -113,29 +111,23 @@ impl ItemScope { | |||
113 | self.legacy_macros.insert(name, mac); | 111 | self.legacy_macros.insert(name, mac); |
114 | } | 112 | } |
115 | 113 | ||
116 | pub(crate) fn push_res(&mut self, name: Name, res: &Resolution, import: bool) -> bool { | 114 | pub(crate) fn push_res(&mut self, name: Name, res: &Resolution, _import: bool) -> bool { |
117 | let mut changed = false; | 115 | let mut changed = false; |
118 | let existing = self.visible.entry(name.clone()).or_default(); | 116 | let existing = self.visible.entry(name.clone()).or_default(); |
119 | 117 | ||
120 | if existing.def.types.is_none() && res.def.types.is_some() { | 118 | if existing.def.types.is_none() && res.def.types.is_some() { |
121 | existing.def.types = res.def.types; | 119 | existing.def.types = res.def.types; |
122 | existing.import = import || res.import; | ||
123 | changed = true; | 120 | changed = true; |
124 | } | 121 | } |
125 | if existing.def.values.is_none() && res.def.values.is_some() { | 122 | if existing.def.values.is_none() && res.def.values.is_some() { |
126 | existing.def.values = res.def.values; | 123 | existing.def.values = res.def.values; |
127 | existing.import = import || res.import; | ||
128 | changed = true; | 124 | changed = true; |
129 | } | 125 | } |
130 | if existing.def.macros.is_none() && res.def.macros.is_some() { | 126 | if existing.def.macros.is_none() && res.def.macros.is_some() { |
131 | existing.def.macros = res.def.macros; | 127 | existing.def.macros = res.def.macros; |
132 | existing.import = import || res.import; | ||
133 | changed = true; | 128 | changed = true; |
134 | } | 129 | } |
135 | 130 | ||
136 | if existing.def.is_none() && res.def.is_none() && !existing.import && res.import { | ||
137 | existing.import = res.import; | ||
138 | } | ||
139 | changed | 131 | changed |
140 | } | 132 | } |
141 | 133 | ||
@@ -152,7 +144,6 @@ impl ItemScope { | |||
152 | pub struct Resolution { | 144 | pub struct Resolution { |
153 | /// None for unresolved | 145 | /// None for unresolved |
154 | pub def: PerNs, | 146 | pub def: PerNs, |
155 | pub(crate) import: bool, | ||
156 | } | 147 | } |
157 | 148 | ||
158 | impl From<ModuleDefId> for PerNs { | 149 | impl From<ModuleDefId> for PerNs { |