mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 11:31:15 +00:00
Merge #9262
9262: fix: Don't keep a trailing `self` token in import paths after `unmerge_use` r=Veykril a=Veykril Fixes #9213 bors r+ Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
This commit is contained in:
commit
278ae172df
@ -73,7 +73,11 @@ fn resolve_full_path(tree: &ast::UseTree) -> Option<ast::Path> {
|
|||||||
for path in paths {
|
for path in paths {
|
||||||
final_path = ast::make::path_concat(path, final_path)
|
final_path = ast::make::path_concat(path, final_path)
|
||||||
}
|
}
|
||||||
Some(final_path)
|
if final_path.segment().map_or(false, |it| it.self_token().is_some()) {
|
||||||
|
final_path.qualifier()
|
||||||
|
} else {
|
||||||
|
Some(final_path)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
@ -223,4 +227,14 @@ pub use std::fmt::Display;
|
|||||||
",
|
",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn unmerge_use_item_on_self() {
|
||||||
|
check_assist(
|
||||||
|
unmerge_use,
|
||||||
|
r"use std::process::{Command, self$0};",
|
||||||
|
r"use std::process::{Command};
|
||||||
|
use std::process;",
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user