@@ -692,30 +692,27 @@ impl<'a> Parser<'a> {
692692 }
693693 }
694694
695- fn parse_dot_or_call_expr_with_ ( & mut self , e0 : P < Expr > , lo : Span ) -> PResult < ' a , P < Expr > > {
696- let mut e = e0;
695+ fn parse_dot_or_call_expr_with_ ( & mut self , mut e : P < Expr > , lo : Span ) -> PResult < ' a , P < Expr > > {
697696 loop {
698- // expr?
699- while self . eat ( & token :: Question ) {
700- let hi = self . prev_span ;
701- e = self . mk_expr ( lo . to ( hi ) , ExprKind :: Try ( e ) , AttrVec :: new ( ) ) ;
697+ if self . eat ( & token :: Question ) {
698+ // `expr?`
699+ e = self . mk_expr ( lo . to ( self . prev_span ) , ExprKind :: Try ( e ) , AttrVec :: new ( ) ) ;
700+ continue ;
702701 }
703-
704- // expr.f
705702 if self . eat ( & token:: Dot ) {
703+ // expr.f
706704 e = self . parse_dot_suffix_expr ( lo, e) ?;
707705 continue ;
708706 }
709707 if self . expr_is_complete ( & e) {
710- break ;
708+ return Ok ( e ) ;
711709 }
712- match self . token . kind {
713- token:: OpenDelim ( token:: Paren ) => e = self . parse_fn_call_expr ( lo, e) ,
714- token:: OpenDelim ( token:: Bracket ) => e = self . parse_index_expr ( lo, e) ?,
710+ e = match self . token . kind {
711+ token:: OpenDelim ( token:: Paren ) => self . parse_fn_call_expr ( lo, e) ,
712+ token:: OpenDelim ( token:: Bracket ) => self . parse_index_expr ( lo, e) ?,
715713 _ => return Ok ( e) ,
716714 }
717715 }
718- return Ok ( e) ;
719716 }
720717
721718 fn parse_dot_suffix_expr ( & mut self , lo : Span , base : P < Expr > ) -> PResult < ' a , P < Expr > > {
0 commit comments