Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/parser/src/grammar/attributes.rs')
| -rw-r--r-- | crates/parser/src/grammar/attributes.rs | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/crates/parser/src/grammar/attributes.rs b/crates/parser/src/grammar/attributes.rs index ccb556b2cc..c0cf43a87b 100644 --- a/crates/parser/src/grammar/attributes.rs +++ b/crates/parser/src/grammar/attributes.rs @@ -24,15 +24,11 @@ fn attr(p: &mut Parser<'_>, inner: bool) { p.bump(T![!]); } - if p.eat(T!['[']) { + if p.expect(T!['[']) { meta(p); - - if !p.eat(T![']']) { - p.error("expected `]`"); - } - } else { - p.error("expected `[`"); + p.expect(T![']']); } + attr.complete(p, ATTR); } @@ -74,7 +70,7 @@ pub(super) fn meta(p: &mut Parser<'_>) { paths::attr_path(p); match p.current() { - T![=] => { + T![=] if !p.at(T![=>]) && !p.at(T![==]) => { p.bump(T![=]); if expressions::expr(p).is_none() { p.error("expected expression"); |