aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_analysis/src/completion/complete_keyword.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-12-21 22:34:22 +0000
committerAleksey Kladov <[email protected]>2018-12-21 22:42:26 +0000
commit284e89406906b97eec8e0f91bce2955a5e94b880 (patch)
treea49f15f70dc20c4429afd62d2d5027d6a8efc607 /crates/ra_analysis/src/completion/complete_keyword.rs
parent25dda42f3773b1d002a5809c0182c2adc6c47027 (diff)
cleanup
Diffstat (limited to 'crates/ra_analysis/src/completion/complete_keyword.rs')
-rw-r--r--crates/ra_analysis/src/completion/complete_keyword.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/crates/ra_analysis/src/completion/complete_keyword.rs b/crates/ra_analysis/src/completion/complete_keyword.rs
index 1e6d7008d..2c7891920 100644
--- a/crates/ra_analysis/src/completion/complete_keyword.rs
+++ b/crates/ra_analysis/src/completion/complete_keyword.rs
@@ -5,7 +5,13 @@ use ra_syntax::{
5 SyntaxKind::*, SyntaxNodeRef, 5 SyntaxKind::*, SyntaxNodeRef,
6}; 6};
7 7
8use crate::completion::{CompletionContext, CompletionItem, Completions, CompletionKind::*}; 8use crate::completion::{CompletionContext, CompletionItem, Completions, CompletionKind};
9
10fn keyword(kw: &str, snippet: &str) -> CompletionItem {
11 CompletionItem::new(CompletionKind::Keyword, kw)
12 .snippet(snippet)
13 .build()
14}
9 15
10pub(super) fn complete_expr_keyword(acc: &mut Completions, ctx: &CompletionContext) { 16pub(super) fn complete_expr_keyword(acc: &mut Completions, ctx: &CompletionContext) {
11 if !ctx.is_trivial_path { 17 if !ctx.is_trivial_path {
@@ -60,10 +66,6 @@ fn complete_return(fn_def: ast::FnDef, is_stmt: bool) -> Option<CompletionItem>
60 Some(keyword("return", snip)) 66 Some(keyword("return", snip))
61} 67}
62 68
63fn keyword(kw: &str, snippet: &str) -> CompletionItem {
64 CompletionItem::new(Keyword, kw).snippet(snippet).build()
65}
66
67#[cfg(test)] 69#[cfg(test)]
68mod tests { 70mod tests {
69 use crate::completion::{CompletionKind, check_completion}; 71 use crate::completion::{CompletionKind, check_completion};