diff options
Diffstat (limited to 'crates/ra_syntax/src/ast')
-rw-r--r-- | crates/ra_syntax/src/ast/edit.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/crates/ra_syntax/src/ast/edit.rs b/crates/ra_syntax/src/ast/edit.rs index 9e5411ee5..26e4576ff 100644 --- a/crates/ra_syntax/src/ast/edit.rs +++ b/crates/ra_syntax/src/ast/edit.rs | |||
@@ -307,7 +307,11 @@ impl ast::UseTree { | |||
307 | 307 | ||
308 | fn split_path_prefix(prefix: &ast::Path) -> Option<ast::Path> { | 308 | fn split_path_prefix(prefix: &ast::Path) -> Option<ast::Path> { |
309 | let parent = prefix.parent_path()?; | 309 | let parent = prefix.parent_path()?; |
310 | let mut res = make::path_unqualified(parent.segment()?); | 310 | let segment = parent.segment()?; |
311 | if algo::has_errors(segment.syntax()) { | ||
312 | return None; | ||
313 | } | ||
314 | let mut res = make::path_unqualified(segment); | ||
311 | for p in iter::successors(parent.parent_path(), |it| it.parent_path()) { | 315 | for p in iter::successors(parent.parent_path(), |it| it.parent_path()) { |
312 | res = make::path_qualified(res, p.segment()?); | 316 | res = make::path_qualified(res, p.segment()?); |
313 | } | 317 | } |