From 1a860dba38225a4d3e122eaf49c926479826becf Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 28 Dec 2018 20:45:58 +0300 Subject: simplify --- crates/ra_hir/src/module.rs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/crates/ra_hir/src/module.rs b/crates/ra_hir/src/module.rs index 43413acb8..24c346984 100644 --- a/crates/ra_hir/src/module.rs +++ b/crates/ra_hir/src/module.rs @@ -13,8 +13,8 @@ use ra_db::{SourceRootId, FileId, Cancelable}; use relative_path::RelativePathBuf; use crate::{ - DefKind, DefLoc, DefId, Path, PathKind, HirDatabase, SourceItemId, SourceFileItemId, Crate, - Name, + Def, DefKind, DefLoc, DefId, + Name, Path, PathKind, HirDatabase, SourceItemId, SourceFileItemId, Crate, arena::{Arena, Id}, }; @@ -139,13 +139,8 @@ impl Module { } else { return Ok(PerNs::none()); }; - let module = match curr.loc(db) { - DefLoc { - kind: DefKind::Module, - source_root_id, - module_id, - .. - } => Module::new(db, source_root_id, module_id)?, + let module = match curr.resolve(db)? { + Def::Module(it) => it, // TODO here would be the place to handle enum variants... _ => return Ok(PerNs::none()), }; -- cgit v1.2.3