diff options
Diffstat (limited to 'crates/syntax/src/ast/edit.rs')
-rw-r--r-- | crates/syntax/src/ast/edit.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/crates/syntax/src/ast/edit.rs b/crates/syntax/src/ast/edit.rs index 5ed123f91..2667d9af4 100644 --- a/crates/syntax/src/ast/edit.rs +++ b/crates/syntax/src/ast/edit.rs | |||
@@ -313,10 +313,15 @@ impl ast::UseTree { | |||
313 | 313 | ||
314 | #[must_use] | 314 | #[must_use] |
315 | pub fn split_prefix(&self, prefix: &ast::Path) -> ast::UseTree { | 315 | pub fn split_prefix(&self, prefix: &ast::Path) -> ast::UseTree { |
316 | let suffix = match split_path_prefix(&prefix) { | 316 | let suffix = if self.path().as_ref() == Some(prefix) && self.use_tree_list().is_none() { |
317 | Some(it) => it, | 317 | make::path_unqualified(make::path_segment_self()) |
318 | None => return self.clone(), | 318 | } else { |
319 | match split_path_prefix(&prefix) { | ||
320 | Some(it) => it, | ||
321 | None => return self.clone(), | ||
322 | } | ||
319 | }; | 323 | }; |
324 | |||
320 | let use_tree = make::use_tree( | 325 | let use_tree = make::use_tree( |
321 | suffix, | 326 | suffix, |
322 | self.use_tree_list(), | 327 | self.use_tree_list(), |