diff options
Diffstat (limited to 'crates/ra_hir/src/path.rs')
-rw-r--r-- | crates/ra_hir/src/path.rs | 9 |
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> { |