diff options
Diffstat (limited to 'crates/ide_completion/src/completions/qualified_path.rs')
-rw-r--r-- | crates/ide_completion/src/completions/qualified_path.rs | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/crates/ide_completion/src/completions/qualified_path.rs b/crates/ide_completion/src/completions/qualified_path.rs index 2afa6979e..df74b739e 100644 --- a/crates/ide_completion/src/completions/qualified_path.rs +++ b/crates/ide_completion/src/completions/qualified_path.rs | |||
@@ -3,7 +3,6 @@ | |||
3 | use hir::{Adt, HasVisibility, PathResolution, ScopeDef}; | 3 | use hir::{Adt, HasVisibility, PathResolution, ScopeDef}; |
4 | use rustc_hash::FxHashSet; | 4 | use rustc_hash::FxHashSet; |
5 | use syntax::AstNode; | 5 | use syntax::AstNode; |
6 | use test_utils::mark; | ||
7 | 6 | ||
8 | use crate::{CompletionContext, Completions}; | 7 | use crate::{CompletionContext, Completions}; |
9 | 8 | ||
@@ -39,7 +38,7 @@ pub(crate) fn complete_qualified_path(acc: &mut Completions, ctx: &CompletionCon | |||
39 | if let Some(name_ref) = ctx.name_ref_syntax.as_ref() { | 38 | if let Some(name_ref) = ctx.name_ref_syntax.as_ref() { |
40 | if name_ref.syntax().text() == name.to_string().as_str() { | 39 | if name_ref.syntax().text() == name.to_string().as_str() { |
41 | // for `use self::foo$0`, don't suggest `foo` as a completion | 40 | // for `use self::foo$0`, don't suggest `foo` as a completion |
42 | mark::hit!(dont_complete_current_use); | 41 | cov_mark::hit!(dont_complete_current_use); |
43 | continue; | 42 | continue; |
44 | } | 43 | } |
45 | } | 44 | } |
@@ -81,9 +80,7 @@ pub(crate) fn complete_qualified_path(acc: &mut Completions, ctx: &CompletionCon | |||
81 | return None; | 80 | return None; |
82 | } | 81 | } |
83 | match item { | 82 | match item { |
84 | hir::AssocItem::Function(func) => { | 83 | hir::AssocItem::Function(func) => acc.add_function(ctx, func, None), |
85 | acc.add_function(ctx, func, None); | ||
86 | } | ||
87 | hir::AssocItem::Const(ct) => acc.add_const(ctx, ct), | 84 | hir::AssocItem::Const(ct) => acc.add_const(ctx, ct), |
88 | hir::AssocItem::TypeAlias(ty) => acc.add_type_alias(ctx, ty), | 85 | hir::AssocItem::TypeAlias(ty) => acc.add_type_alias(ctx, ty), |
89 | } | 86 | } |
@@ -110,9 +107,7 @@ pub(crate) fn complete_qualified_path(acc: &mut Completions, ctx: &CompletionCon | |||
110 | continue; | 107 | continue; |
111 | } | 108 | } |
112 | match item { | 109 | match item { |
113 | hir::AssocItem::Function(func) => { | 110 | hir::AssocItem::Function(func) => acc.add_function(ctx, func, None), |
114 | acc.add_function(ctx, func, None); | ||
115 | } | ||
116 | hir::AssocItem::Const(ct) => acc.add_const(ctx, ct), | 111 | hir::AssocItem::Const(ct) => acc.add_const(ctx, ct), |
117 | hir::AssocItem::TypeAlias(ty) => acc.add_type_alias(ctx, ty), | 112 | hir::AssocItem::TypeAlias(ty) => acc.add_type_alias(ctx, ty), |
118 | } | 113 | } |
@@ -143,9 +138,7 @@ pub(crate) fn complete_qualified_path(acc: &mut Completions, ctx: &CompletionCon | |||
143 | // them. | 138 | // them. |
144 | if seen.insert(item) { | 139 | if seen.insert(item) { |
145 | match item { | 140 | match item { |
146 | hir::AssocItem::Function(func) => { | 141 | hir::AssocItem::Function(func) => acc.add_function(ctx, func, None), |
147 | acc.add_function(ctx, func, None); | ||
148 | } | ||
149 | hir::AssocItem::Const(ct) => acc.add_const(ctx, ct), | 142 | hir::AssocItem::Const(ct) => acc.add_const(ctx, ct), |
150 | hir::AssocItem::TypeAlias(ty) => acc.add_type_alias(ctx, ty), | 143 | hir::AssocItem::TypeAlias(ty) => acc.add_type_alias(ctx, ty), |
151 | } | 144 | } |
@@ -161,7 +154,6 @@ pub(crate) fn complete_qualified_path(acc: &mut Completions, ctx: &CompletionCon | |||
161 | #[cfg(test)] | 154 | #[cfg(test)] |
162 | mod tests { | 155 | mod tests { |
163 | use expect_test::{expect, Expect}; | 156 | use expect_test::{expect, Expect}; |
164 | use test_utils::mark; | ||
165 | 157 | ||
166 | use crate::{ | 158 | use crate::{ |
167 | test_utils::{check_edit, completion_list}, | 159 | test_utils::{check_edit, completion_list}, |
@@ -180,7 +172,7 @@ mod tests { | |||
180 | 172 | ||
181 | #[test] | 173 | #[test] |
182 | fn dont_complete_current_use() { | 174 | fn dont_complete_current_use() { |
183 | mark::check!(dont_complete_current_use); | 175 | cov_mark::check!(dont_complete_current_use); |
184 | check(r#"use self::foo$0;"#, expect![[""]]); | 176 | check(r#"use self::foo$0;"#, expect![[""]]); |
185 | } | 177 | } |
186 | 178 | ||