diff options
author | Jeremy A. Kolb <[email protected]> | 2018-10-15 22:44:23 +0100 |
---|---|---|
committer | Jeremy A. Kolb <[email protected]> | 2018-10-16 14:41:10 +0100 |
commit | 61f3a438d3a729a6be941bca1ff4c6a97a33f221 (patch) | |
tree | 6551967cc8c6e921b66071453ad7888a9121d326 /crates/ra_syntax/src/grammar/patterns.rs | |
parent | 39cb6c6d3f78b193f5873c3492e530bbd24d5dd2 (diff) |
Cargo Format
Run `cargo fmt` and ignore generated files
Diffstat (limited to 'crates/ra_syntax/src/grammar/patterns.rs')
-rw-r--r-- | crates/ra_syntax/src/grammar/patterns.rs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/crates/ra_syntax/src/grammar/patterns.rs b/crates/ra_syntax/src/grammar/patterns.rs index 420bae7a7..9d35dbb3d 100644 --- a/crates/ra_syntax/src/grammar/patterns.rs +++ b/crates/ra_syntax/src/grammar/patterns.rs | |||
@@ -1,11 +1,10 @@ | |||
1 | use super::*; | 1 | use super::*; |
2 | 2 | ||
3 | pub(super) const PATTERN_FIRST: TokenSet = | 3 | pub(super) const PATTERN_FIRST: TokenSet = token_set_union![ |
4 | token_set_union![ | 4 | token_set![REF_KW, MUT_KW, L_PAREN, L_BRACK, AMP, UNDERSCORE], |
5 | token_set![REF_KW, MUT_KW, L_PAREN, L_BRACK, AMP, UNDERSCORE], | 5 | expressions::LITERAL_FIRST, |
6 | expressions::LITERAL_FIRST, | 6 | paths::PATH_FIRST, |
7 | paths::PATH_FIRST, | 7 | ]; |
8 | ]; | ||
9 | 8 | ||
10 | pub(super) fn pattern(p: &mut Parser) { | 9 | pub(super) fn pattern(p: &mut Parser) { |
11 | pattern_r(p, PAT_RECOVERY_SET) | 10 | pattern_r(p, PAT_RECOVERY_SET) |
@@ -29,12 +28,13 @@ pub(super) fn pattern_r(p: &mut Parser, recovery_set: TokenSet) { | |||
29 | const PAT_RECOVERY_SET: TokenSet = | 28 | const PAT_RECOVERY_SET: TokenSet = |
30 | token_set![LET_KW, IF_KW, WHILE_KW, LOOP_KW, MATCH_KW, R_PAREN, COMMA]; | 29 | token_set![LET_KW, IF_KW, WHILE_KW, LOOP_KW, MATCH_KW, R_PAREN, COMMA]; |
31 | 30 | ||
32 | |||
33 | fn atom_pat(p: &mut Parser, recovery_set: TokenSet) -> Option<CompletedMarker> { | 31 | fn atom_pat(p: &mut Parser, recovery_set: TokenSet) -> Option<CompletedMarker> { |
34 | let la0 = p.nth(0); | 32 | let la0 = p.nth(0); |
35 | let la1 = p.nth(1); | 33 | let la1 = p.nth(1); |
36 | if la0 == REF_KW || la0 == MUT_KW | 34 | if la0 == REF_KW |
37 | || (la0 == IDENT && !(la1 == COLONCOLON || la1 == L_PAREN || la1 == L_CURLY)) { | 35 | || la0 == MUT_KW |
36 | || (la0 == IDENT && !(la1 == COLONCOLON || la1 == L_PAREN || la1 == L_CURLY)) | ||
37 | { | ||
38 | return Some(bind_pat(p, true)); | 38 | return Some(bind_pat(p, true)); |
39 | } | 39 | } |
40 | if paths::is_path_start(p) { | 40 | if paths::is_path_start(p) { |
@@ -87,7 +87,7 @@ fn path_pat(p: &mut Parser) -> CompletedMarker { | |||
87 | field_pat_list(p); | 87 | field_pat_list(p); |
88 | STRUCT_PAT | 88 | STRUCT_PAT |
89 | } | 89 | } |
90 | _ => PATH_PAT | 90 | _ => PATH_PAT, |
91 | }; | 91 | }; |
92 | m.complete(p, kind) | 92 | m.complete(p, kind) |
93 | } | 93 | } |
@@ -195,7 +195,7 @@ fn pat_list(p: &mut Parser, ket: SyntaxKind) { | |||
195 | break; | 195 | break; |
196 | } | 196 | } |
197 | pattern(p) | 197 | pattern(p) |
198 | }, | 198 | } |
199 | } | 199 | } |
200 | if !p.at(ket) { | 200 | if !p.at(ket) { |
201 | p.expect(COMMA); | 201 | p.expect(COMMA); |