From f5e0a31eaf9ddd7788e6261d49f4d18e8463a719 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 24 Nov 2019 18:05:12 +0300 Subject: Cleanup nameres --- crates/ra_hir/src/code_model.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'crates/ra_hir/src') diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index b3e2ff1c2..9f06b147c 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs @@ -62,7 +62,7 @@ impl Crate { } pub fn root_module(self, db: &impl DefDatabase) -> Option { - let module_id = db.crate_def_map(self.crate_id).root(); + let module_id = db.crate_def_map(self.crate_id).root; Some(Module::new(self, module_id)) } @@ -195,7 +195,7 @@ impl Module { /// in the module tree of any target in `Cargo.toml`. pub fn crate_root(self, db: &impl DefDatabase) -> Module { let def_map = db.crate_def_map(self.id.krate); - self.with_module_id(def_map.root()) + self.with_module_id(def_map.root) } /// Finds a child module with the specified name. -- cgit v1.2.3 From 434f108adad75b7c5e25db745a9f9fefa5cdaa31 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 24 Nov 2019 18:48:29 +0300 Subject: Simplify --- crates/ra_hir/src/expr.rs | 6 +++--- crates/ra_hir/src/test_db.rs | 2 +- crates/ra_hir/src/ty/infer.rs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'crates/ra_hir/src') diff --git a/crates/ra_hir/src/expr.rs b/crates/ra_hir/src/expr.rs index 6b703d8b4..43fedde7a 100644 --- a/crates/ra_hir/src/expr.rs +++ b/crates/ra_hir/src/expr.rs @@ -44,15 +44,15 @@ impl<'a, 'b> ExprValidator<'a, 'b> { pub(crate) fn validate_body(&mut self, db: &impl HirDatabase) { let body = self.func.body(db); - for e in body.exprs() { + for e in body.exprs.iter() { if let (id, Expr::RecordLit { path, fields, spread }) = e { self.validate_record_literal(id, path, fields, *spread, db); } } - let body_expr = &body[body.body_expr()]; + let body_expr = &body[body.body_expr]; if let Expr::Block { statements: _, tail: Some(t) } = body_expr { - self.validate_results_in_tail_expr(body.body_expr(), *t, db); + self.validate_results_in_tail_expr(body.body_expr, *t, db); } } diff --git a/crates/ra_hir/src/test_db.rs b/crates/ra_hir/src/test_db.rs index 03c7ac155..efee2f658 100644 --- a/crates/ra_hir/src/test_db.rs +++ b/crates/ra_hir/src/test_db.rs @@ -80,7 +80,7 @@ impl TestDB { let crate_graph = self.crate_graph(); for krate in crate_graph.iter().next() { let crate_def_map = self.crate_def_map(krate); - for module_id in crate_def_map.modules() { + for (module_id, _) in crate_def_map.modules.iter() { let module_id = ModuleId { krate, module_id }; let module = crate::Module::from(module_id); module.diagnostics( diff --git a/crates/ra_hir/src/ty/infer.rs b/crates/ra_hir/src/ty/infer.rs index 471bdc387..2e744e5ec 100644 --- a/crates/ra_hir/src/ty/infer.rs +++ b/crates/ra_hir/src/ty/infer.rs @@ -565,7 +565,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { fn collect_fn(&mut self, data: &FunctionData) { let body = Arc::clone(&self.body); // avoid borrow checker problem - for (type_ref, pat) in data.params.iter().zip(body.params()) { + for (type_ref, pat) in data.params.iter().zip(body.params.iter()) { let ty = self.make_ty(type_ref); self.infer_pat(*pat, &ty, BindingMode::default()); @@ -574,7 +574,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { } fn infer_body(&mut self) { - self.infer_expr(self.body.body_expr(), &Expectation::has_type(self.return_ty.clone())); + self.infer_expr(self.body.body_expr, &Expectation::has_type(self.return_ty.clone())); } fn resolve_into_iter_item(&self) -> Option { -- cgit v1.2.3