diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-03-02 13:00:28 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-03-02 13:00:28 +0000 |
commit | cf23ca771967d473a2efd0c0b0cf9f285dc3107e (patch) | |
tree | 99633035713bf0ffa3c63f46ca5a6622770a959e /crates/ra_assists/src | |
parent | f40ed3fcb037885e0111fc3da6ba5b9eb0bef2b4 (diff) | |
parent | 503ffb48931275f5c44471a1e0c1b2e7a599df43 (diff) |
Merge #3396
3396: One more assert r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_assists/src')
-rw-r--r-- | crates/ra_assists/src/ast_transform.rs | 7 |
1 files changed, 6 insertions, 1 deletions
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> { | |||
178 | 178 | ||
179 | pub(crate) fn path_to_ast(path: hir::ModPath) -> ast::Path { | 179 | pub(crate) fn path_to_ast(path: hir::ModPath) -> ast::Path { |
180 | let parse = ast::SourceFile::parse(&path.to_string()); | 180 | let parse = ast::SourceFile::parse(&path.to_string()); |
181 | parse.tree().syntax().descendants().find_map(ast::Path::cast).unwrap() | 181 | parse |
182 | .tree() | ||
183 | .syntax() | ||
184 | .descendants() | ||
185 | .find_map(ast::Path::cast) | ||
186 | .unwrap_or_else(|| panic!("failed to parse path {:?}, `{}`", path, path)) | ||
182 | } | 187 | } |