aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_completion
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide_completion')
-rw-r--r--crates/ide_completion/src/completions/keyword.rs8
-rw-r--r--crates/ide_completion/src/completions/qualified_path.rs12
2 files changed, 11 insertions, 9 deletions
diff --git a/crates/ide_completion/src/completions/keyword.rs b/crates/ide_completion/src/completions/keyword.rs
index 17bd19522..03c6dd454 100644
--- a/crates/ide_completion/src/completions/keyword.rs
+++ b/crates/ide_completion/src/completions/keyword.rs
@@ -91,6 +91,7 @@ pub(crate) fn complete_expr_keyword(acc: &mut Completions, ctx: &CompletionConte
91 if ctx.is_expr { 91 if ctx.is_expr {
92 add_keyword(ctx, acc, "match", "match $0 {}"); 92 add_keyword(ctx, acc, "match", "match $0 {}");
93 add_keyword(ctx, acc, "while", "while $0 {}"); 93 add_keyword(ctx, acc, "while", "while $0 {}");
94 add_keyword(ctx, acc, "while let", "while let $1 = $0 {}");
94 add_keyword(ctx, acc, "loop", "loop {$0}"); 95 add_keyword(ctx, acc, "loop", "loop {$0}");
95 add_keyword(ctx, acc, "if", "if $0 {}"); 96 add_keyword(ctx, acc, "if", "if $0 {}");
96 add_keyword(ctx, acc, "if let", "if let $1 = $0 {}"); 97 add_keyword(ctx, acc, "if let", "if let $1 = $0 {}");
@@ -269,6 +270,7 @@ mod tests {
269 kw trait 270 kw trait
270 kw match 271 kw match
271 kw while 272 kw while
273 kw while let
272 kw loop 274 kw loop
273 kw if 275 kw if
274 kw if let 276 kw if let
@@ -296,6 +298,7 @@ mod tests {
296 kw trait 298 kw trait
297 kw match 299 kw match
298 kw while 300 kw while
301 kw while let
299 kw loop 302 kw loop
300 kw if 303 kw if
301 kw if let 304 kw if let
@@ -323,6 +326,7 @@ mod tests {
323 kw trait 326 kw trait
324 kw match 327 kw match
325 kw while 328 kw while
329 kw while let
326 kw loop 330 kw loop
327 kw if 331 kw if
328 kw if let 332 kw if let
@@ -357,6 +361,7 @@ fn quux() -> i32 {
357 expect![[r#" 361 expect![[r#"
358 kw match 362 kw match
359 kw while 363 kw while
364 kw while let
360 kw loop 365 kw loop
361 kw if 366 kw if
362 kw if let 367 kw if let
@@ -406,6 +411,7 @@ fn quux() -> i32 {
406 kw trait 411 kw trait
407 kw match 412 kw match
408 kw while 413 kw while
414 kw while let
409 kw loop 415 kw loop
410 kw if 416 kw if
411 kw if let 417 kw if let
@@ -565,6 +571,7 @@ pub mod future {
565 expect![[r#" 571 expect![[r#"
566 kw match 572 kw match
567 kw while 573 kw while
574 kw while let
568 kw loop 575 kw loop
569 kw if 576 kw if
570 kw if let 577 kw if let
@@ -624,6 +631,7 @@ fn foo() {
624 expect![[r#" 631 expect![[r#"
625 kw match 632 kw match
626 kw while 633 kw while
634 kw while let
627 kw loop 635 kw loop
628 kw if 636 kw if
629 kw if let 637 kw if let
diff --git a/crates/ide_completion/src/completions/qualified_path.rs b/crates/ide_completion/src/completions/qualified_path.rs
index 2afa6979e..72fb757b1 100644
--- a/crates/ide_completion/src/completions/qualified_path.rs
+++ b/crates/ide_completion/src/completions/qualified_path.rs
@@ -81,9 +81,7 @@ pub(crate) fn complete_qualified_path(acc: &mut Completions, ctx: &CompletionCon
81 return None; 81 return None;
82 } 82 }
83 match item { 83 match item {
84 hir::AssocItem::Function(func) => { 84 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), 85 hir::AssocItem::Const(ct) => acc.add_const(ctx, ct),
88 hir::AssocItem::TypeAlias(ty) => acc.add_type_alias(ctx, ty), 86 hir::AssocItem::TypeAlias(ty) => acc.add_type_alias(ctx, ty),
89 } 87 }
@@ -110,9 +108,7 @@ pub(crate) fn complete_qualified_path(acc: &mut Completions, ctx: &CompletionCon
110 continue; 108 continue;
111 } 109 }
112 match item { 110 match item {
113 hir::AssocItem::Function(func) => { 111 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), 112 hir::AssocItem::Const(ct) => acc.add_const(ctx, ct),
117 hir::AssocItem::TypeAlias(ty) => acc.add_type_alias(ctx, ty), 113 hir::AssocItem::TypeAlias(ty) => acc.add_type_alias(ctx, ty),
118 } 114 }
@@ -143,9 +139,7 @@ pub(crate) fn complete_qualified_path(acc: &mut Completions, ctx: &CompletionCon
143 // them. 139 // them.
144 if seen.insert(item) { 140 if seen.insert(item) {
145 match item { 141 match item {
146 hir::AssocItem::Function(func) => { 142 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), 143 hir::AssocItem::Const(ct) => acc.add_const(ctx, ct),
150 hir::AssocItem::TypeAlias(ty) => acc.add_type_alias(ctx, ty), 144 hir::AssocItem::TypeAlias(ty) => acc.add_type_alias(ctx, ty),
151 } 145 }