diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-05-26 20:11:47 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-05-26 20:11:47 +0100 |
commit | 1caf79c3893359af65b1441821ba2d18814656df (patch) | |
tree | d63bfa5a27928f55828c7c38b669e2105bb9baf9 /crates/ide_completion/src/completions | |
parent | bb1c7fc0cfe24a8477d943faa932992b9cd48957 (diff) | |
parent | 26e784a575c760087bdb321932e823ad27046024 (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.rs | 6 |
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 | ||
3 | use std::iter; | 3 | use std::iter; |
4 | 4 | ||
5 | use syntax::SyntaxKind; | 5 | use syntax::{SyntaxKind, T}; |
6 | 6 | ||
7 | use crate::{CompletionContext, CompletionItem, CompletionItemKind, CompletionKind, Completions}; | 7 | use 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 | ||