From 21ea62d2927ad88c56a4cb48bbd9932ba7bf5321 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 15 Jan 2020 14:42:57 +0100 Subject: Don't parse child modules when doing diagnostics --- crates/ra_hir/src/code_model.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/ra_hir') 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::{ builtin_type::BuiltinType, docs::Documentation, expr::{BindingAnnotation, Pat, PatId}, - nameres::ModuleSource, per_ns::PerNs, resolver::HasResolver, type_ref::{Mutability, TypeRef}, @@ -193,13 +192,14 @@ impl Module { pub fn diagnostics(self, db: &impl HirDatabase, sink: &mut DiagnosticSink) { let _p = profile("Module::diagnostics"); - db.crate_def_map(self.id.krate).add_diagnostics(db, self.id.local_id, sink); + let crate_def_map = db.crate_def_map(self.id.krate); + crate_def_map.add_diagnostics(db, self.id.local_id, sink); for decl in self.declarations(db) { match decl { crate::ModuleDef::Function(f) => f.diagnostics(db, sink), crate::ModuleDef::Module(m) => { // Only add diagnostics from inline modules - if let ModuleSource::Module(_) = m.definition_source(db).value { + if crate_def_map[m.id.local_id].origin.is_inline() { m.diagnostics(db, sink) } } -- cgit v1.2.3