diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-01-15 13:45:40 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-01-15 13:45:40 +0000 |
commit | fdb13dade970d730468cab80ab62837124b08195 (patch) | |
tree | 909f5a76dd04943a6d3217232eec8262563e43ab /crates/ra_hir | |
parent | 4a9e4ec7e181c9cb17fe574073c2b718611ccec3 (diff) | |
parent | 21ea62d2927ad88c56a4cb48bbd9932ba7bf5321 (diff) |
Merge #2852
2852: Don't parse child modules when doing diagnostics r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir')
-rw-r--r-- | crates/ra_hir/src/code_model.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index 3b479356f..500b34c17 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs | |||
@@ -7,7 +7,6 @@ use hir_def::{ | |||
7 | builtin_type::BuiltinType, | 7 | builtin_type::BuiltinType, |
8 | docs::Documentation, | 8 | docs::Documentation, |
9 | expr::{BindingAnnotation, Pat, PatId}, | 9 | expr::{BindingAnnotation, Pat, PatId}, |
10 | nameres::ModuleSource, | ||
11 | per_ns::PerNs, | 10 | per_ns::PerNs, |
12 | resolver::HasResolver, | 11 | resolver::HasResolver, |
13 | type_ref::{Mutability, TypeRef}, | 12 | type_ref::{Mutability, TypeRef}, |
@@ -193,13 +192,14 @@ impl Module { | |||
193 | 192 | ||
194 | pub fn diagnostics(self, db: &impl HirDatabase, sink: &mut DiagnosticSink) { | 193 | pub fn diagnostics(self, db: &impl HirDatabase, sink: &mut DiagnosticSink) { |
195 | let _p = profile("Module::diagnostics"); | 194 | let _p = profile("Module::diagnostics"); |
196 | db.crate_def_map(self.id.krate).add_diagnostics(db, self.id.local_id, sink); | 195 | let crate_def_map = db.crate_def_map(self.id.krate); |
196 | crate_def_map.add_diagnostics(db, self.id.local_id, sink); | ||
197 | for decl in self.declarations(db) { | 197 | for decl in self.declarations(db) { |
198 | match decl { | 198 | match decl { |
199 | crate::ModuleDef::Function(f) => f.diagnostics(db, sink), | 199 | crate::ModuleDef::Function(f) => f.diagnostics(db, sink), |
200 | crate::ModuleDef::Module(m) => { | 200 | crate::ModuleDef::Module(m) => { |
201 | // Only add diagnostics from inline modules | 201 | // Only add diagnostics from inline modules |
202 | if let ModuleSource::Module(_) = m.definition_source(db).value { | 202 | if crate_def_map[m.id.local_id].origin.is_inline() { |
203 | m.diagnostics(db, sink) | 203 | m.diagnostics(db, sink) |
204 | } | 204 | } |
205 | } | 205 | } |