@@ -49,7 +49,7 @@ impl<'a> Parser<'a> {
4949 let gated_leading_vert = self . eat_or_separator ( ) && gate_or == GateOr :: Yes ;
5050
5151 // Parse the possibly-or-pattern.
52- let pat = self . parse_pat_with_or ( None , gate_or, TopLevel :: Yes ) ?;
52+ let pat = self . parse_pat_with_or ( gate_or, TopLevel :: Yes ) ?;
5353
5454 // If we parsed a leading `|` which should be gated,
5555 // and no other gated or-pattern has been parsed thus far,
@@ -67,14 +67,9 @@ impl<'a> Parser<'a> {
6767
6868 /// Parses a pattern, that may be a or-pattern (e.g. `Foo | Bar` in `Some(Foo | Bar)`).
6969 /// Corresponds to `pat<allow_top_alt>` in RFC 2535.
70- fn parse_pat_with_or (
71- & mut self ,
72- expected : Expected ,
73- gate_or : GateOr ,
74- top_level : TopLevel ,
75- ) -> PResult < ' a , P < Pat > > {
70+ fn parse_pat_with_or ( & mut self , gate_or : GateOr , top_level : TopLevel ) -> PResult < ' a , P < Pat > > {
7671 // Parse the first pattern.
77- let first_pat = self . parse_pat ( expected ) ?;
72+ let first_pat = self . parse_pat ( None ) ?;
7873 self . maybe_recover_unexpected_comma ( first_pat. span , top_level) ?;
7974
8075 // If the next token is not a `|`,
@@ -86,7 +81,7 @@ impl<'a> Parser<'a> {
8681 let lo = first_pat. span ;
8782 let mut pats = vec ! [ first_pat] ;
8883 while self . eat_or_separator ( ) {
89- let pat = self . parse_pat ( expected ) ?;
84+ let pat = self . parse_pat ( None ) ?;
9085 self . maybe_recover_unexpected_comma ( pat. span , top_level) ?;
9186 pats. push ( pat) ;
9287 }
@@ -177,9 +172,9 @@ impl<'a> Parser<'a> {
177172
178173 /// Recursive possibly-or-pattern parser with recovery for an erroneous leading `|`.
179174 /// See `parse_pat_with_or` for details on parsing or-patterns.
180- fn parse_pat_with_or_inner ( & mut self , expected : Expected ) -> PResult < ' a , P < Pat > > {
175+ fn parse_pat_with_or_inner ( & mut self ) -> PResult < ' a , P < Pat > > {
181176 self . recover_inner_leading_vert ( ) ;
182- self . parse_pat_with_or ( expected , GateOr :: Yes , TopLevel :: No )
177+ self . parse_pat_with_or ( GateOr :: Yes , TopLevel :: No )
183178 }
184179
185180 /// Recover if `|` or `||` is here.
@@ -215,7 +210,7 @@ impl<'a> Parser<'a> {
215210 // Parse `[pat, pat,...]` as a slice pattern.
216211 let ( pats, _) = self . parse_delim_comma_seq (
217212 token:: Bracket ,
218- |p| p. parse_pat_with_or_inner ( None ) ,
213+ |p| p. parse_pat_with_or_inner ( ) ,
219214 ) ?;
220215 PatKind :: Slice ( pats)
221216 }
@@ -344,9 +339,7 @@ impl<'a> Parser<'a> {
344339
345340 /// Parse a tuple or parenthesis pattern.
346341 fn parse_pat_tuple_or_parens ( & mut self ) -> PResult < ' a , PatKind > {
347- let ( fields, trailing_comma) = self . parse_paren_comma_seq ( |p| {
348- p. parse_pat_with_or_inner ( None )
349- } ) ?;
342+ let ( fields, trailing_comma) = self . parse_paren_comma_seq ( |p| p. parse_pat_with_or_inner ( ) ) ?;
350343
351344 // Here, `(pat,)` is a tuple pattern.
352345 // For backward compatibility, `(..)` is a tuple pattern as well.
@@ -589,7 +582,7 @@ impl<'a> Parser<'a> {
589582 err. span_label ( self . token . span , msg) ;
590583 return Err ( err) ;
591584 }
592- let ( fields, _) = self . parse_paren_comma_seq ( |p| p. parse_pat_with_or_inner ( None ) ) ?;
585+ let ( fields, _) = self . parse_paren_comma_seq ( |p| p. parse_pat_with_or_inner ( ) ) ?;
593586 Ok ( PatKind :: TupleStruct ( path, fields) )
594587 }
595588
@@ -733,7 +726,7 @@ impl<'a> Parser<'a> {
733726 // Parsing a pattern of the form "fieldname: pat"
734727 let fieldname = self . parse_field_name ( ) ?;
735728 self . bump ( ) ;
736- let pat = self . parse_pat_with_or_inner ( None ) ?;
729+ let pat = self . parse_pat_with_or_inner ( ) ?;
737730 hi = pat. span ;
738731 ( pat, fieldname, false )
739732 } else {
0 commit comments