@@ -11,12 +11,12 @@ use crate::errors::{
1111 DoubleColonInBound , ExpectedIdentifier , ExpectedSemi , ExpectedSemiSugg ,
1212 GenericParamsWithoutAngleBrackets , GenericParamsWithoutAngleBracketsSugg ,
1313 HelpIdentifierStartsWithNumber , InInTypo , IncorrectAwait , IncorrectSemicolon ,
14- IncorrectUseOfAwait , ParenthesesInForHead , ParenthesesInForHeadSugg ,
15- PatternMethodParamWithoutBody , QuestionMarkInType , QuestionMarkInTypeSugg , SelfParamNotFirst ,
16- StructLiteralBodyWithoutPath , StructLiteralBodyWithoutPathSugg , StructLiteralNeedingParens ,
17- StructLiteralNeedingParensSugg , SuggAddMissingLetStmt , SuggEscapeIdentifier , SuggRemoveComma ,
18- TernaryOperator , UnexpectedConstInGenericParam , UnexpectedConstParamDeclaration ,
19- UnexpectedConstParamDeclarationSugg , UnmatchedAngleBrackets , UseEqInstead , WrapType ,
14+ IncorrectUseOfAwait , PatternMethodParamWithoutBody , QuestionMarkInType , QuestionMarkInTypeSugg ,
15+ SelfParamNotFirst , StructLiteralBodyWithoutPath , StructLiteralBodyWithoutPathSugg ,
16+ StructLiteralNeedingParens , StructLiteralNeedingParensSugg , SuggAddMissingLetStmt ,
17+ SuggEscapeIdentifier , SuggRemoveComma , TernaryOperator , UnexpectedConstInGenericParam ,
18+ UnexpectedConstParamDeclaration , UnexpectedConstParamDeclarationSugg , UnmatchedAngleBrackets ,
19+ UseEqInstead , WrapType ,
2020} ;
2121
2222use crate :: fluent_generated as fluent;
@@ -1897,37 +1897,6 @@ impl<'a> Parser<'a> {
18971897 }
18981898 }
18991899
1900- /// Recovers a situation like `for ( $pat in $expr )`
1901- /// and suggest writing `for $pat in $expr` instead.
1902- ///
1903- /// This should be called before parsing the `$block`.
1904- pub ( super ) fn recover_parens_around_for_head (
1905- & mut self ,
1906- pat : P < Pat > ,
1907- begin_paren : Option < ( Span , Span ) > ,
1908- ) -> P < Pat > {
1909- match ( & self . token . kind , begin_paren) {
1910- ( token:: CloseDelim ( Delimiter :: Parenthesis ) , Some ( ( begin_par_sp, left) ) ) => {
1911- let right = self . prev_token . span . between ( self . look_ahead ( 1 , |t| t. span ) ) ;
1912- self . bump ( ) ;
1913- self . sess . emit_err ( ParenthesesInForHead {
1914- span : vec ! [ begin_par_sp, self . prev_token. span] ,
1915- // With e.g. `for (x) in y)` this would replace `(x) in y)`
1916- // with `x) in y)` which is syntactically invalid.
1917- // However, this is prevented before we get here.
1918- sugg : ParenthesesInForHeadSugg { left, right } ,
1919- } ) ;
1920-
1921- // Unwrap `(pat)` into `pat` to avoid the `unused_parens` lint.
1922- pat. and_then ( |pat| match pat. kind {
1923- PatKind :: Paren ( pat) => pat,
1924- _ => P ( pat) ,
1925- } )
1926- }
1927- _ => pat,
1928- }
1929- }
1930-
19311900 pub ( super ) fn recover_seq_parse_error (
19321901 & mut self ,
19331902 delim : Delimiter ,
0 commit comments