From b7c45fba57224a013fbc926abd2e8e9f8f3c77d4 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 17 Jan 2020 11:44:40 +0100 Subject: Extract expr_with_attrs --- crates/ra_parser/src/grammar/expressions/atom.rs | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) (limited to 'crates/ra_parser/src/grammar/expressions') diff --git a/crates/ra_parser/src/grammar/expressions/atom.rs b/crates/ra_parser/src/grammar/expressions/atom.rs index a98a2a3ef..2cc321473 100644 --- a/crates/ra_parser/src/grammar/expressions/atom.rs +++ b/crates/ra_parser/src/grammar/expressions/atom.rs @@ -191,19 +191,8 @@ fn array_expr(p: &mut Parser) -> CompletedMarker { // test array_attrs // const A: &[i64] = &[1, #[cfg(test)] 2]; - let m = p.start(); - let has_attrs = p.at(T![#]); - attributes::outer_attributes(p); - - let cm = expr(p).0; - - match (has_attrs, cm) { - (true, Some(cm)) => { - let kind = cm.kind(); - cm.undo_completion(p).abandon(p); - m.complete(p, kind); - } - _ => m.abandon(p), + if !expr_with_attrs(p) { + break; } if n_exprs == 1 && p.eat(T![;]) { -- cgit v1.2.3