mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
**Merge Imports** assist handles self
This commit is contained in:
parent
d583f2c46d
commit
0635458a6b
3 changed files with 38 additions and 3 deletions
|
@ -313,10 +313,15 @@ impl ast::UseTree {
|
|||
|
||||
#[must_use]
|
||||
pub fn split_prefix(&self, prefix: &ast::Path) -> ast::UseTree {
|
||||
let suffix = match split_path_prefix(&prefix) {
|
||||
Some(it) => it,
|
||||
None => return self.clone(),
|
||||
let suffix = if self.path().as_ref() == Some(prefix) && self.use_tree_list().is_none() {
|
||||
make::path_unqualified(make::path_segment_self())
|
||||
} else {
|
||||
match split_path_prefix(&prefix) {
|
||||
Some(it) => it,
|
||||
None => return self.clone(),
|
||||
}
|
||||
};
|
||||
|
||||
let use_tree = make::use_tree(
|
||||
suffix,
|
||||
self.use_tree_list(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue