fix: merge_imports::recursive_merge exiting early

This commit is contained in:
iDawer 2022-04-02 14:18:42 +05:00
parent b4c608896c
commit c8c21aabff
2 changed files with 2 additions and 2 deletions

View File

@ -129,7 +129,7 @@ fn recursive_merge(lhs: &ast::UseTree, rhs: &ast::UseTree, merge: MergeBehavior)
_ => (), _ => (),
} }
if lhs_t.use_tree_list().is_none() && rhs_t.use_tree_list().is_none() { if lhs_t.is_simple_path() && rhs_t.is_simple_path() {
continue; continue;
} }
} }

View File

@ -328,7 +328,7 @@ impl ast::UseTree {
return; return;
} }
// At this point, prefix path is detached; _self_ use tree has suffix path. // At this point, prefix path is detached; _self_ use tree has suffix path.
// Next, transoform 'suffix' use tree into 'prefix::{suffix}' // Next, transform 'suffix' use tree into 'prefix::{suffix}'
let subtree = self.clone_subtree().clone_for_update(); let subtree = self.clone_subtree().clone_for_update();
ted::remove_all_iter(self.syntax().children_with_tokens()); ted::remove_all_iter(self.syntax().children_with_tokens());
ted::insert(Position::first_child_of(self.syntax()), prefix.syntax()); ted::insert(Position::first_child_of(self.syntax()), prefix.syntax());