aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_completion/src/completions
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-05-26 20:11:47 +0100
committerGitHub <[email protected]>2021-05-26 20:11:47 +0100
commit1caf79c3893359af65b1441821ba2d18814656df (patch)
treed63bfa5a27928f55828c7c38b669e2105bb9baf9 /crates/ide_completion/src/completions
parentbb1c7fc0cfe24a8477d943faa932992b9cd48957 (diff)
parent26e784a575c760087bdb321932e823ad27046024 (diff)
Merge #9014
9014: simplify r=Veykril a=Veykril bors r+ Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/ide_completion/src/completions')
-rw-r--r--crates/ide_completion/src/completions/keyword.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/ide_completion/src/completions/keyword.rs b/crates/ide_completion/src/completions/keyword.rs
index 61b667104..d2d0e4a98 100644
--- a/crates/ide_completion/src/completions/keyword.rs
+++ b/crates/ide_completion/src/completions/keyword.rs
@@ -2,7 +2,7 @@
2 2
3use std::iter; 3use std::iter;
4 4
5use syntax::SyntaxKind; 5use syntax::{SyntaxKind, T};
6 6
7use crate::{CompletionContext, CompletionItem, CompletionItemKind, CompletionKind, Completions}; 7use crate::{CompletionContext, CompletionItem, CompletionItemKind, CompletionKind, Completions};
8 8
@@ -54,7 +54,7 @@ pub(crate) fn complete_expr_keyword(acc: &mut Completions, ctx: &CompletionConte
54 add_keyword(ctx, acc, "where", "where "); 54 add_keyword(ctx, acc, "where", "where ");
55 return; 55 return;
56 } 56 }
57 if ctx.unsafe_is_prev { 57 if ctx.previous_token_is(T![unsafe]) {
58 if ctx.has_item_list_or_source_file_parent || ctx.block_expr_parent { 58 if ctx.has_item_list_or_source_file_parent || ctx.block_expr_parent {
59 add_keyword(ctx, acc, "fn", "fn $0() {}") 59 add_keyword(ctx, acc, "fn", "fn $0() {}")
60 } 60 }
@@ -92,7 +92,7 @@ pub(crate) fn complete_expr_keyword(acc: &mut Completions, ctx: &CompletionConte
92 add_keyword(ctx, acc, "for", "for $1 in $0 {}"); 92 add_keyword(ctx, acc, "for", "for $1 in $0 {}");
93 } 93 }
94 94
95 if ctx.if_is_prev || ctx.block_expr_parent { 95 if ctx.previous_token_is(T![if]) || ctx.previous_token_is(T![while]) || ctx.block_expr_parent {
96 add_keyword(ctx, acc, "let", "let "); 96 add_keyword(ctx, acc, "let", "let ");
97 } 97 }
98 98