aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/path.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-10-29 13:19:45 +0000
committerGitHub <[email protected]>2019-10-29 13:19:45 +0000
commite38cdf6e56d963525fcc656b80965e7114756496 (patch)
tree4ca01adaa4ade6e90d7bcf20748dd691cdb5151d /crates/ra_hir/src/path.rs
parente960414a4d2a654898e697d267a5d95eb93271a0 (diff)
parentbca708ba4c5eb474448ef2f2882a66ec935f2fee (diff)
Merge #2114
2114: Move macro expansion to a separate crate r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir/src/path.rs')
-rw-r--r--crates/ra_hir/src/path.rs9
1 files changed, 7 insertions, 2 deletions
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 {
66 mut cb: impl FnMut(Path, &ast::UseTree, bool, Option<Name>), 66 mut cb: impl FnMut(Path, &ast::UseTree, bool, Option<Name>),
67 ) { 67 ) {
68 if let Some(tree) = item_src.ast.use_tree() { 68 if let Some(tree) = item_src.ast.use_tree() {
69 expand_use_tree(None, tree, &|| item_src.file_id.macro_crate(db), &mut cb); 69 expand_use_tree(
70 None,
71 tree,
72 &|| item_src.file_id.macro_crate(db).map(|crate_id| Crate { crate_id }),
73 &mut cb,
74 );
70 } 75 }
71 } 76 }
72 77
@@ -90,7 +95,7 @@ impl Path {
90 /// It correctly handles `$crate` based path from macro call. 95 /// It correctly handles `$crate` based path from macro call.
91 pub fn from_src(source: Source<ast::Path>, db: &impl AstDatabase) -> Option<Path> { 96 pub fn from_src(source: Source<ast::Path>, db: &impl AstDatabase) -> Option<Path> {
92 let file_id = source.file_id; 97 let file_id = source.file_id;
93 Path::parse(source.ast, &|| file_id.macro_crate(db)) 98 Path::parse(source.ast, &|| file_id.macro_crate(db).map(|crate_id| Crate { crate_id }))
94 } 99 }
95 100
96 fn parse(mut path: ast::Path, macro_crate: &impl Fn() -> Option<Crate>) -> Option<Path> { 101 fn parse(mut path: ast::Path, macro_crate: &impl Fn() -> Option<Crate>) -> Option<Path> {