@@ -732,43 +732,42 @@ impl<'a> Parser<'a> {
732732 mut e : DiagnosticBuilder < ' a , ErrorReported > ,
733733 expr : & mut P < Expr > ,
734734 ) -> PResult < ' a , ( ) > {
735- if let ExprKind :: Binary ( binop, _, _) = & expr. kind {
736- if let ast:: BinOpKind :: Lt = binop. node {
737- if self . eat ( & token:: Comma ) {
738- let x = self . parse_seq_to_before_end (
739- & token:: Gt ,
740- SeqSep :: trailing_allowed ( token:: Comma ) ,
741- |p| p. parse_generic_arg ( None ) ,
742- ) ;
743- match x {
744- Ok ( ( _, _, false ) ) => {
745- if self . eat ( & token:: Gt ) {
746- e. span_suggestion_verbose (
747- binop. span . shrink_to_lo ( ) ,
748- TURBOFISH_SUGGESTION_STR ,
749- "::" . to_string ( ) ,
750- Applicability :: MaybeIncorrect ,
751- )
752- . emit ( ) ;
753- match self . parse_expr ( ) {
754- Ok ( _) => {
755- * expr =
756- self . mk_expr_err ( expr. span . to ( self . prev_token . span ) ) ;
757- return Ok ( ( ) ) ;
758- }
759- Err ( err) => {
760- * expr = self . mk_expr_err ( expr. span ) ;
761- err. cancel ( ) ;
762- }
763- }
735+ if let ExprKind :: Binary ( binop, _, _) = & expr. kind
736+ && let ast:: BinOpKind :: Lt = binop. node
737+ && self . eat ( & token:: Comma )
738+ {
739+ let x = self . parse_seq_to_before_end (
740+ & token:: Gt ,
741+ SeqSep :: trailing_allowed ( token:: Comma ) ,
742+ |p| p. parse_generic_arg ( None ) ,
743+ ) ;
744+ match x {
745+ Ok ( ( _, _, false ) ) => {
746+ if self . eat ( & token:: Gt ) {
747+ e. span_suggestion_verbose (
748+ binop. span . shrink_to_lo ( ) ,
749+ TURBOFISH_SUGGESTION_STR ,
750+ "::" . to_string ( ) ,
751+ Applicability :: MaybeIncorrect ,
752+ )
753+ . emit ( ) ;
754+ match self . parse_expr ( ) {
755+ Ok ( _) => {
756+ * expr =
757+ self . mk_expr_err ( expr. span . to ( self . prev_token . span ) ) ;
758+ return Ok ( ( ) ) ;
759+ }
760+ Err ( err) => {
761+ * expr = self . mk_expr_err ( expr. span ) ;
762+ err. cancel ( ) ;
764763 }
765764 }
766- Err ( err) => {
767- err. cancel ( ) ;
768- }
769- _ => { }
770765 }
771766 }
767+ Err ( err) => {
768+ err. cancel ( ) ;
769+ }
770+ _ => { }
772771 }
773772 }
774773 Err ( e)
@@ -784,12 +783,13 @@ impl<'a> Parser<'a> {
784783 outer_op : & Spanned < AssocOp > ,
785784 ) -> bool /* advanced the cursor */ {
786785 if let ExprKind :: Binary ( op, ref l1, ref r1) = inner_op. kind {
787- if let ExprKind :: Field ( _, ident) = l1. kind {
788- if ident. as_str ( ) . parse :: < i32 > ( ) . is_err ( ) && !matches ! ( r1. kind, ExprKind :: Lit ( _) ) {
789- // The parser has encountered `foo.bar<baz`, the likelihood of the turbofish
790- // suggestion being the only one to apply is high.
791- return false ;
792- }
786+ if let ExprKind :: Field ( _, ident) = l1. kind
787+ && ident. as_str ( ) . parse :: < i32 > ( ) . is_err ( )
788+ && !matches ! ( r1. kind, ExprKind :: Lit ( _) )
789+ {
790+ // The parser has encountered `foo.bar<baz`, the likelihood of the turbofish
791+ // suggestion being the only one to apply is high.
792+ return false ;
793793 }
794794 let mut enclose = |left : Span , right : Span | {
795795 err. multipart_suggestion (
0 commit comments