From 541387564483ee3a42a1969fd048f94e57599ca4 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 29 Oct 2019 14:55:39 +0300 Subject: move expansion-related code to a separate crate --- crates/ra_hir/src/path.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'crates/ra_hir/src/path.rs') diff --git a/crates/ra_hir/src/path.rs b/crates/ra_hir/src/path.rs index 394617e1a..bbe536bcb 100644 --- a/crates/ra_hir/src/path.rs +++ b/crates/ra_hir/src/path.rs @@ -66,7 +66,12 @@ impl Path { mut cb: impl FnMut(Path, &ast::UseTree, bool, Option), ) { if let Some(tree) = item_src.ast.use_tree() { - expand_use_tree(None, tree, &|| item_src.file_id.macro_crate(db), &mut cb); + expand_use_tree( + None, + tree, + &|| item_src.file_id.macro_crate(db).map(|crate_id| Crate { crate_id }), + &mut cb, + ); } } @@ -90,7 +95,7 @@ impl Path { /// It correctly handles `$crate` based path from macro call. pub fn from_src(source: Source, db: &impl AstDatabase) -> Option { let file_id = source.file_id; - Path::parse(source.ast, &|| file_id.macro_crate(db)) + Path::parse(source.ast, &|| file_id.macro_crate(db).map(|crate_id| Crate { crate_id })) } fn parse(mut path: ast::Path, macro_crate: &impl Fn() -> Option) -> Option { -- cgit v1.2.3