diff options
author | Dmitry <[email protected]> | 2020-08-09 14:35:51 +0100 |
---|---|---|
committer | Dmitry <[email protected]> | 2020-08-09 14:39:32 +0100 |
commit | 8068302fefc75440b823f4bf1731a5f347d7c767 (patch) | |
tree | 251b967182e79bc82a58c2fb208c688f6152df1f /crates/ra_ide/src/completion/complete_attribute.rs | |
parent | 1a43a0f63e0008787225abb6fb2baef97b6a39e0 (diff) | |
parent | 8a57afe5a4bfab40072a83f7dc4ca560bf860919 (diff) |
Merge remote-tracking branch 'origin/master'
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(()) |