diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-12-21 11:48:12 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2019-12-21 11:48:12 +0000 |
commit | cdc9d682b066b110e0a44e5f8f1c574b38c16ba9 (patch) | |
tree | d1429d913719f73b4dee771e0c9ce85e871fc54a /crates/ra_hir/src/code_model.rs | |
parent | 90ef070db3dce0a7acb9cd11d0b0d72de13c9d79 (diff) | |
parent | 2d3fdf3fb52f32ececdfa19df7ab2971a24bae71 (diff) |
Merge #2629
2629: Remove imports from hir r=matklad a=matklad
We only used them to avoid self-confirming completions (`use self::foo`), but that can be handled more locally.
bors r+
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/code_model.rs')
-rw-r--r-- | crates/ra_hir/src/code_model.rs | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index fca3a2950..e6768ea0b 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs | |||
@@ -12,8 +12,8 @@ use hir_def::{ | |||
12 | resolver::HasResolver, | 12 | resolver::HasResolver, |
13 | type_ref::{Mutability, TypeRef}, | 13 | type_ref::{Mutability, TypeRef}, |
14 | AdtId, ConstId, DefWithBodyId, EnumId, FunctionId, HasModule, ImplId, LocalEnumVariantId, | 14 | AdtId, ConstId, DefWithBodyId, EnumId, FunctionId, HasModule, ImplId, LocalEnumVariantId, |
15 | LocalImportId, LocalModuleId, LocalStructFieldId, Lookup, ModuleId, StaticId, StructId, | 15 | LocalModuleId, LocalStructFieldId, Lookup, ModuleId, StaticId, StructId, TraitId, TypeAliasId, |
16 | TraitId, TypeAliasId, TypeParamId, UnionId, | 16 | TypeParamId, UnionId, |
17 | }; | 17 | }; |
18 | use hir_expand::{ | 18 | use hir_expand::{ |
19 | diagnostics::DiagnosticSink, | 19 | diagnostics::DiagnosticSink, |
@@ -180,13 +180,11 @@ impl Module { | |||
180 | } | 180 | } |
181 | 181 | ||
182 | /// Returns a `ModuleScope`: a set of items, visible in this module. | 182 | /// Returns a `ModuleScope`: a set of items, visible in this module. |
183 | pub fn scope(self, db: &impl HirDatabase) -> Vec<(Name, ScopeDef, Option<Import>)> { | 183 | pub fn scope(self, db: &impl HirDatabase) -> Vec<(Name, ScopeDef)> { |
184 | db.crate_def_map(self.id.krate)[self.id.local_id] | 184 | db.crate_def_map(self.id.krate)[self.id.local_id] |
185 | .scope | 185 | .scope |
186 | .entries() | 186 | .entries() |
187 | .map(|(name, res)| { | 187 | .map(|(name, res)| (name.clone(), res.def.into())) |
188 | (name.clone(), res.def.into(), res.import.map(|id| Import { parent: self, id })) | ||
189 | }) | ||
190 | .collect() | 188 | .collect() |
191 | } | 189 | } |
192 | 190 | ||
@@ -229,10 +227,10 @@ impl Module { | |||
229 | } | 227 | } |
230 | } | 228 | } |
231 | 229 | ||
232 | pub struct Import { | 230 | // pub struct Import { |
233 | pub(crate) parent: Module, | 231 | // pub(crate) parent: Module, |
234 | pub(crate) id: LocalImportId, | 232 | // pub(crate) id: LocalImportId, |
235 | } | 233 | // } |
236 | 234 | ||
237 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] | 235 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] |
238 | pub struct StructField { | 236 | pub struct StructField { |