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 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'crates/ra_parser/src/grammar/attributes.rs') 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![']']) { -- cgit v1.2.3