diff options
Diffstat (limited to 'crates/ide_assists')
-rw-r--r-- | crates/ide_assists/src/handlers/qualify_path.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/crates/ide_assists/src/handlers/qualify_path.rs b/crates/ide_assists/src/handlers/qualify_path.rs index 1fb4931cd..c0463311e 100644 --- a/crates/ide_assists/src/handlers/qualify_path.rs +++ b/crates/ide_assists/src/handlers/qualify_path.rs | |||
@@ -1,7 +1,10 @@ | |||
1 | use std::iter; | 1 | use std::iter; |
2 | 2 | ||
3 | use hir::AsAssocItem; | 3 | use hir::AsAssocItem; |
4 | use ide_db::helpers::{import_assets::ImportCandidate, mod_path_to_ast}; | 4 | use ide_db::helpers::{ |
5 | import_assets::{ImportCandidate, Qualifier}, | ||
6 | mod_path_to_ast, | ||
7 | }; | ||
5 | use ide_db::RootDatabase; | 8 | use ide_db::RootDatabase; |
6 | use syntax::{ | 9 | use syntax::{ |
7 | ast, | 10 | ast, |
@@ -45,7 +48,7 @@ pub(crate) fn qualify_path(acc: &mut Assists, ctx: &AssistContext) -> Option<()> | |||
45 | 48 | ||
46 | let qualify_candidate = match candidate { | 49 | let qualify_candidate = match candidate { |
47 | ImportCandidate::Path(candidate) => { | 50 | ImportCandidate::Path(candidate) => { |
48 | if candidate.unresolved_qualifier.is_some() { | 51 | if !matches!(candidate.qualifier, Qualifier::Absent) { |
49 | cov_mark::hit!(qualify_path_qualifier_start); | 52 | cov_mark::hit!(qualify_path_qualifier_start); |
50 | let path = ast::Path::cast(syntax_under_caret)?; | 53 | let path = ast::Path::cast(syntax_under_caret)?; |
51 | let (prev_segment, segment) = (path.qualifier()?.segment()?, path.segment()?); | 54 | let (prev_segment, segment) = (path.qualifier()?.segment()?, path.segment()?); |
@@ -192,7 +195,7 @@ fn group_label(candidate: &ImportCandidate) -> GroupLabel { | |||
192 | fn label(candidate: &ImportCandidate, import: &hir::ModPath) -> String { | 195 | fn label(candidate: &ImportCandidate, import: &hir::ModPath) -> String { |
193 | match candidate { | 196 | match candidate { |
194 | ImportCandidate::Path(candidate) => { | 197 | ImportCandidate::Path(candidate) => { |
195 | if candidate.unresolved_qualifier.is_some() { | 198 | if !matches!(candidate.qualifier, Qualifier::Absent) { |
196 | format!("Qualify with `{}`", &import) | 199 | format!("Qualify with `{}`", &import) |
197 | } else { | 200 | } else { |
198 | format!("Qualify as `{}`", &import) | 201 | format!("Qualify as `{}`", &import) |