From b82fe73d1ab9727ff650382d9c86a231b06245be Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 18 Jan 2019 11:02:30 +0300 Subject: make token set a const-fn --- crates/ra_syntax/src/grammar/expressions/atom.rs | 45 +++++++++++------------- 1 file changed, 21 insertions(+), 24 deletions(-) (limited to 'crates/ra_syntax/src/grammar/expressions') diff --git a/crates/ra_syntax/src/grammar/expressions/atom.rs b/crates/ra_syntax/src/grammar/expressions/atom.rs index 31b09ac5b..167a76551 100644 --- a/crates/ra_syntax/src/grammar/expressions/atom.rs +++ b/crates/ra_syntax/src/grammar/expressions/atom.rs @@ -36,29 +36,26 @@ pub(crate) fn literal(p: &mut Parser) -> Option { } // E.g. for after the break in `if break {}`, this should not match -pub(super) const ATOM_EXPR_FIRST: TokenSet = token_set_union![ - LITERAL_FIRST, - token_set![ - L_PAREN, - L_CURLY, - L_BRACK, - PIPE, - MOVE_KW, - IF_KW, - WHILE_KW, - MATCH_KW, - UNSAFE_KW, - RETURN_KW, - IDENT, - SELF_KW, - SUPER_KW, - CRATE_KW, - COLONCOLON, - BREAK_KW, - CONTINUE_KW, - LIFETIME - ], -]; +pub(super) const ATOM_EXPR_FIRST: TokenSet = LITERAL_FIRST.union(token_set![ + L_PAREN, + L_CURLY, + L_BRACK, + PIPE, + MOVE_KW, + IF_KW, + WHILE_KW, + MATCH_KW, + UNSAFE_KW, + RETURN_KW, + IDENT, + SELF_KW, + SUPER_KW, + CRATE_KW, + COLONCOLON, + BREAK_KW, + CONTINUE_KW, + LIFETIME, +]); const EXPR_RECOVERY_SET: TokenSet = token_set![LET_KW]; @@ -363,7 +360,7 @@ pub(crate) fn match_arm_list(p: &mut Parser) { fn match_arm(p: &mut Parser) -> BlockLike { let m = p.start(); p.eat(PIPE); - patterns::pattern_r(p, TokenSet::EMPTY); + patterns::pattern_r(p, TokenSet::empty()); while p.eat(PIPE) { patterns::pattern(p); } -- cgit v1.2.3