@@ -202,9 +202,13 @@ impl<'a> Parser<'a> {
202
202
} else {
203
203
// Try to parse everything else as literal with optional minus
204
204
match self . parse_literal_maybe_minus ( ) {
205
- Ok ( begin) if self . check ( & token:: DotDot ) || self . check ( & token:: DotDotEq )
206
- || self . check ( & token:: DotDotDot )
207
- => self . parse_pat_range_starting_with_lit ( begin) ?,
205
+ Ok ( begin)
206
+ if self . check ( & token:: DotDot )
207
+ || self . check ( & token:: DotDotEq )
208
+ || self . check ( & token:: DotDotDot ) =>
209
+ {
210
+ self . parse_pat_range_starting_with_lit ( begin) ?
211
+ }
208
212
Ok ( begin) => PatKind :: Lit ( begin) ,
209
213
Err ( mut err) => {
210
214
self . cancel ( & mut err) ;
@@ -446,28 +450,26 @@ impl<'a> Parser<'a> {
446
450
}
447
451
448
452
/// Parses `ident` or `ident @ pat`.
449
- /// used by the copy foo and ref foo patterns to give a good
453
+ /// Used by the copy foo and ref foo patterns to give a good
450
454
/// error message when parsing mistakes like `ref foo(a, b)`.
451
- fn parse_pat_ident ( & mut self ,
452
- binding_mode : ast:: BindingMode )
453
- -> PResult < ' a , PatKind > {
455
+ fn parse_pat_ident ( & mut self , binding_mode : BindingMode ) -> PResult < ' a , PatKind > {
454
456
let ident = self . parse_ident ( ) ?;
455
457
let sub = if self . eat ( & token:: At ) {
456
458
Some ( self . parse_pat ( Some ( "binding pattern" ) ) ?)
457
459
} else {
458
460
None
459
461
} ;
460
462
461
- // just to be friendly, if they write something like
462
- // ref Some(i)
463
- // we end up here with ( as the current token. This shortly
464
- // leads to a parse error. Note that if there is no explicit
463
+ // Just to be friendly, if they write something like `ref Some(i)`,
464
+ // we end up here with `(` as the current token.
465
+ // This shortly leads to a parse error. Note that if there is no explicit
465
466
// binding mode then we do not end up here, because the lookahead
466
- // will direct us over to parse_enum_variant()
467
+ // will direct us over to ` parse_enum_variant()`.
467
468
if self . token == token:: OpenDelim ( token:: Paren ) {
468
469
return Err ( self . span_fatal (
469
470
self . prev_span ,
470
- "expected identifier, found enum pattern" ) )
471
+ "expected identifier, found enum pattern" ,
472
+ ) )
471
473
}
472
474
473
475
Ok ( PatKind :: Ident ( binding_mode, ident, sub) )
0 commit comments