diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-07-30 19:39:09 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-07-30 19:39:09 +0100 |
commit | 6f5b53013c54fa6d8429b717998cdb77a4d68b2c (patch) | |
tree | c09cf0434ecf282cf1763d34cf838952db105e0a /crates/ra_ide | |
parent | e28ea81b2b68a61b5c5eec3c815172b17256a25f (diff) | |
parent | fbe60a2e284035d16c2a1ee743ee88db418689aa (diff) |
Merge #5611
5611: Finalize attribute grammar r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_ide')
-rw-r--r-- | crates/ra_ide/src/completion/complete_attribute.rs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/crates/ra_ide/src/completion/complete_attribute.rs b/crates/ra_ide/src/completion/complete_attribute.rs index 109c5e9a8..2faaae974 100644 --- a/crates/ra_ide/src/completion/complete_attribute.rs +++ b/crates/ra_ide/src/completion/complete_attribute.rs | |||
@@ -13,20 +13,18 @@ use crate::completion::{ | |||
13 | 13 | ||
14 | pub(super) fn complete_attribute(acc: &mut Completions, ctx: &CompletionContext) -> Option<()> { | 14 | pub(super) fn complete_attribute(acc: &mut Completions, ctx: &CompletionContext) -> Option<()> { |
15 | let attribute = ctx.attribute_under_caret.as_ref()?; | 15 | let attribute = ctx.attribute_under_caret.as_ref()?; |
16 | match (attribute.path(), attribute.input()) { | 16 | match (attribute.path(), attribute.token_tree()) { |
17 | (Some(path), Some(ast::AttrInput::TokenTree(token_tree))) | 17 | (Some(path), Some(token_tree)) if path.to_string() == "derive" => { |
18 | if path.to_string() == "derive" => | ||
19 | { | ||
20 | complete_derive(acc, ctx, token_tree) | 18 | complete_derive(acc, ctx, token_tree) |
21 | } | 19 | } |
22 | (Some(path), Some(ast::AttrInput::TokenTree(token_tree))) | 20 | (Some(path), Some(token_tree)) |
23 | if ["allow", "warn", "deny", "forbid"] | 21 | if ["allow", "warn", "deny", "forbid"] |
24 | .iter() | 22 | .iter() |
25 | .any(|lint_level| lint_level == &path.to_string()) => | 23 | .any(|lint_level| lint_level == &path.to_string()) => |
26 | { | 24 | { |
27 | complete_lint(acc, ctx, token_tree) | 25 | complete_lint(acc, ctx, token_tree) |
28 | } | 26 | } |
29 | (_, Some(ast::AttrInput::TokenTree(_token_tree))) => {} | 27 | (_, Some(_token_tree)) => {} |
30 | _ => complete_attribute_start(acc, ctx, attribute), | 28 | _ => complete_attribute_start(acc, ctx, attribute), |
31 | } | 29 | } |
32 | Some(()) | 30 | Some(()) |