From f7e12559cb26b59a9a2ecee4deecaf6fe9100d16 Mon Sep 17 00:00:00 2001 From: uHOOCCOOHu Date: Mon, 30 Sep 2019 16:09:02 +0800 Subject: Fixes --- crates/ra_parser/src/grammar/attributes.rs | 18 ++++++++---------- crates/ra_syntax/src/ast/extensions.rs | 9 --------- 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/crates/ra_parser/src/grammar/attributes.rs b/crates/ra_parser/src/grammar/attributes.rs index 72e7717b7..63ca9ca32 100644 --- a/crates/ra_parser/src/grammar/attributes.rs +++ b/crates/ra_parser/src/grammar/attributes.rs @@ -25,17 +25,15 @@ fn attribute(p: &mut Parser, inner: bool) { if p.eat(T!['[']) { paths::use_path(p); - let is_delimiter = |p: &mut Parser| match p.current() { - T!['('] | T!['['] | T!['{'] => true, - _ => false, - }; - - if p.eat(T![=]) { - if expressions::literal(p).is_none() { - p.error("expected literal"); + match p.current() { + T![=] => { + p.bump(T![=]); + if expressions::literal(p).is_none() { + p.error("expected literal"); + } } - } else if is_delimiter(p) { - items::token_tree(p); + T!['('] | T!['['] | T!['{'] => items::token_tree(p), + _ => {} } if !p.eat(T![']']) { diff --git a/crates/ra_syntax/src/ast/extensions.rs b/crates/ra_syntax/src/ast/extensions.rs index a7b886457..cefc00402 100644 --- a/crates/ra_syntax/src/ast/extensions.rs +++ b/crates/ra_syntax/src/ast/extensions.rs @@ -36,15 +36,6 @@ fn text_of_first_token(node: &SyntaxNode) -> &SmolStr { } impl ast::Attr { - pub fn is_inner(&self) -> bool { - let prev = match self.syntax().prev_sibling() { - None => return false, - Some(prev) => prev, - }; - - prev.kind() == T![!] - } - pub fn as_simple_atom(&self) -> Option { match self.input() { None => self.simple_name(), -- cgit v1.2.3