From 6615fda695dfe6cb2c6792eed5d472b43ac63423 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Thu, 17 Dec 2020 01:19:56 +0100 Subject: decl_check: don't pass `db` around so often --- crates/hir/src/code_model.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'crates/hir/src') diff --git a/crates/hir/src/code_model.rs b/crates/hir/src/code_model.rs index 9bfcd215a..b1a1bc337 100644 --- a/crates/hir/src/code_model.rs +++ b/crates/hir/src/code_model.rs @@ -267,7 +267,12 @@ impl ModuleDef { _ => return, }; - hir_ty::diagnostics::validate_module_item(db, id, sink) + let module = match self.module(db) { + Some(it) => it, + None => return, + }; + + hir_ty::diagnostics::validate_module_item(db, module.id.krate, id, sink) } } @@ -780,8 +785,9 @@ impl Function { } pub fn diagnostics(self, db: &dyn HirDatabase, sink: &mut DiagnosticSink) { + let krate = self.module(db).id.krate; hir_def::diagnostics::validate_body(db.upcast(), self.id.into(), sink); - hir_ty::diagnostics::validate_module_item(db, self.id.into(), sink); + hir_ty::diagnostics::validate_module_item(db, krate, self.id.into(), sink); hir_ty::diagnostics::validate_body(db, self.id.into(), sink); } -- cgit v1.2.3