aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_parser/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_parser/src')
-rw-r--r--crates/ra_parser/src/grammar/patterns.rs15
1 files changed, 8 insertions, 7 deletions
diff --git a/crates/ra_parser/src/grammar/patterns.rs b/crates/ra_parser/src/grammar/patterns.rs
index c6a2e4d39..3afbaa82b 100644
--- a/crates/ra_parser/src/grammar/patterns.rs
+++ b/crates/ra_parser/src/grammar/patterns.rs
@@ -41,16 +41,14 @@ fn pattern_r(p: &mut Parser, recovery_set: TokenSet) {
41 let m = p.start(); 41 let m = p.start();
42 pattern_single_r(p, recovery_set); 42 pattern_single_r(p, recovery_set);
43 43
44 let mut is_or_pat = false; 44 if !p.at(T![|]) {
45 m.abandon(p);
46 return;
47 }
45 while p.eat(T![|]) { 48 while p.eat(T![|]) {
46 is_or_pat = true;
47 pattern_single_r(p, recovery_set); 49 pattern_single_r(p, recovery_set);
48 } 50 }
49 if is_or_pat { 51 m.complete(p, OR_PAT);
50 m.complete(p, OR_PAT);
51 } else {
52 m.abandon(p);
53 }
54} 52}
55 53
56fn pattern_single_r(p: &mut Parser, recovery_set: TokenSet) { 54fn pattern_single_r(p: &mut Parser, recovery_set: TokenSet) {
@@ -292,6 +290,9 @@ fn ref_pat(p: &mut Parser) -> CompletedMarker {
292// test tuple_pat 290// test tuple_pat
293// fn main() { 291// fn main() {
294// let (a, b, ..) = (); 292// let (a, b, ..) = ();
293// let (a,) = ();
294// let (..) = ();
295// let () = ();
295// } 296// }
296fn tuple_pat(p: &mut Parser) -> CompletedMarker { 297fn tuple_pat(p: &mut Parser) -> CompletedMarker {
297 assert!(p.at(T!['('])); 298 assert!(p.at(T!['(']));