From 503ffb48931275f5c44471a1e0c1b2e7a599df43 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 2 Mar 2020 13:59:35 +0100 Subject: One more assert --- crates/ra_assists/src/ast_transform.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'crates/ra_assists/src') diff --git a/crates/ra_assists/src/ast_transform.rs b/crates/ra_assists/src/ast_transform.rs index 0e53c1eee..42856f0ca 100644 --- a/crates/ra_assists/src/ast_transform.rs +++ b/crates/ra_assists/src/ast_transform.rs @@ -178,5 +178,10 @@ impl<'a> AstTransform<'a> for QualifyPaths<'a> { pub(crate) fn path_to_ast(path: hir::ModPath) -> ast::Path { 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)) } -- cgit v1.2.3