aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-06-14 12:57:20 +0100
committerGitHub <[email protected]>2021-06-14 12:57:20 +0100
commit278ae172df6c1c49e2d8ecf6ef47de4dc73ddc59 (patch)
treed9bfc9f1b0c2caf0475b39db64c1e730373bb2cf /crates
parent388a91c8a8d542f7a8e0ddff879cce4d4c2b20ae (diff)
parent7cf273a18e7893f2c57bf4430c8962685ed10c09 (diff)
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 <[email protected]>
Diffstat (limited to 'crates')
-rw-r--r--crates/ide_assists/src/handlers/unmerge_use.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/crates/ide_assists/src/handlers/unmerge_use.rs b/crates/ide_assists/src/handlers/unmerge_use.rs
index 8d271e056..14e862cd0 100644
--- a/crates/ide_assists/src/handlers/unmerge_use.rs
+++ b/crates/ide_assists/src/handlers/unmerge_use.rs
@@ -73,7 +73,11 @@ fn resolve_full_path(tree: &ast::UseTree) -> Option<ast::Path> {
73 for path in paths { 73 for path in paths {
74 final_path = ast::make::path_concat(path, final_path) 74 final_path = ast::make::path_concat(path, final_path)
75 } 75 }
76 Some(final_path) 76 if final_path.segment().map_or(false, |it| it.self_token().is_some()) {
77 final_path.qualifier()
78 } else {
79 Some(final_path)
80 }
77} 81}
78 82
79#[cfg(test)] 83#[cfg(test)]
@@ -223,4 +227,14 @@ pub use std::fmt::Display;
223", 227",
224 ); 228 );
225 } 229 }
230
231 #[test]
232 fn unmerge_use_item_on_self() {
233 check_assist(
234 unmerge_use,
235 r"use std::process::{Command, self$0};",
236 r"use std::process::{Command};
237use std::process;",
238 );
239 }
226} 240}