diff options
Diffstat (limited to 'crates/ra_ide/src/completion/complete_attribute.rs')
-rw-r--r-- | crates/ra_ide/src/completion/complete_attribute.rs | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/crates/ra_ide/src/completion/complete_attribute.rs b/crates/ra_ide/src/completion/complete_attribute.rs index 7a4274645..089d806d8 100644 --- a/crates/ra_ide/src/completion/complete_attribute.rs +++ b/crates/ra_ide/src/completion/complete_attribute.rs | |||
@@ -16,25 +16,23 @@ use crate::completion::UNSTABLE_FEATURE_DESCRIPTOR; | |||
16 | 16 | ||
17 | pub(super) fn complete_attribute(acc: &mut Completions, ctx: &CompletionContext) -> Option<()> { | 17 | pub(super) fn complete_attribute(acc: &mut Completions, ctx: &CompletionContext) -> Option<()> { |
18 | let attribute = ctx.attribute_under_caret.as_ref()?; | 18 | let attribute = ctx.attribute_under_caret.as_ref()?; |
19 | match (attribute.path(), attribute.input()) { | 19 | match (attribute.path(), attribute.token_tree()) { |
20 | (Some(path), Some(ast::AttrInput::TokenTree(token_tree))) | 20 | (Some(path), Some(token_tree)) if path.to_string() == "derive" => { |
21 | if path.to_string() == "derive" => | ||
22 | { | ||
23 | complete_derive(acc, ctx, token_tree) | 21 | complete_derive(acc, ctx, token_tree) |
24 | } | 22 | } |
25 | (Some(path), Some(ast::AttrInput::TokenTree(token_tree))) | 23 | (Some(path), Some(token_tree)) |
26 | if path.to_string() == "feature" => | 24 | if path.to_string() == "feature" => |
27 | { | 25 | { |
28 | complete_lint(acc, ctx, token_tree, UNSTABLE_FEATURE_DESCRIPTOR); | 26 | complete_lint(acc, ctx, token_tree, UNSTABLE_FEATURE_DESCRIPTOR); |
29 | } | 27 | } |
30 | (Some(path), Some(ast::AttrInput::TokenTree(token_tree))) | 28 | (Some(path), Some(token_tree)) |
31 | if ["allow", "warn", "deny", "forbid"] | 29 | if ["allow", "warn", "deny", "forbid"] |
32 | .iter() | 30 | .iter() |
33 | .any(|lint_level| lint_level == &path.to_string()) => | 31 | .any(|lint_level| lint_level == &path.to_string()) => |
34 | { | 32 | { |
35 | complete_lint(acc, ctx, token_tree, DEFAULT_LINT_COMPLETIONS) | 33 | complete_lint(acc, ctx, token_tree, DEFAULT_LINT_COMPLETIONS) |
36 | } | 34 | } |
37 | (_, Some(ast::AttrInput::TokenTree(_token_tree))) => {} | 35 | (_, Some(_token_tree)) => {} |
38 | _ => complete_attribute_start(acc, ctx, attribute), | 36 | _ => complete_attribute_start(acc, ctx, attribute), |
39 | } | 37 | } |
40 | Some(()) | 38 | Some(()) |