mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 22:54:58 +00:00
Merge #3396
3396: One more assert r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
commit
cf23ca7719
1 changed files with 6 additions and 1 deletions
|
@ -178,5 +178,10 @@ impl<'a> AstTransform<'a> for QualifyPaths<'a> {
|
||||||
|
|
||||||
pub(crate) fn path_to_ast(path: hir::ModPath) -> ast::Path {
|
pub(crate) fn path_to_ast(path: hir::ModPath) -> ast::Path {
|
||||||
let parse = ast::SourceFile::parse(&path.to_string());
|
let parse = ast::SourceFile::parse(&path.to_string());
|
||||||
parse.tree().syntax().descendants().find_map(ast::Path::cast).unwrap()
|
parse
|
||||||
|
.tree()
|
||||||
|
.syntax()
|
||||||
|
.descendants()
|
||||||
|
.find_map(ast::Path::cast)
|
||||||
|
.unwrap_or_else(|| panic!("failed to parse path {:?}, `{}`", path, path))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue