@@ -11,12 +11,12 @@ use crate::errors::{
11
11
DoubleColonInBound , ExpectedIdentifier , ExpectedSemi , ExpectedSemiSugg ,
12
12
GenericParamsWithoutAngleBrackets , GenericParamsWithoutAngleBracketsSugg ,
13
13
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 ,
20
20
} ;
21
21
22
22
use crate :: fluent_generated as fluent;
@@ -1895,37 +1895,6 @@ impl<'a> Parser<'a> {
1895
1895
}
1896
1896
}
1897
1897
1898
- /// Recovers a situation like `for ( $pat in $expr )`
1899
- /// and suggest writing `for $pat in $expr` instead.
1900
- ///
1901
- /// This should be called before parsing the `$block`.
1902
- pub ( super ) fn recover_parens_around_for_head (
1903
- & mut self ,
1904
- pat : P < Pat > ,
1905
- begin_paren : Option < ( Span , Span ) > ,
1906
- ) -> P < Pat > {
1907
- match ( & self . token . kind , begin_paren) {
1908
- ( token:: CloseDelim ( Delimiter :: Parenthesis ) , Some ( ( begin_par_sp, left) ) ) => {
1909
- let right = self . prev_token . span . between ( self . look_ahead ( 1 , |t| t. span ) ) ;
1910
- self . bump ( ) ;
1911
- self . sess . emit_err ( ParenthesesInForHead {
1912
- span : vec ! [ begin_par_sp, self . prev_token. span] ,
1913
- // With e.g. `for (x) in y)` this would replace `(x) in y)`
1914
- // with `x) in y)` which is syntactically invalid.
1915
- // However, this is prevented before we get here.
1916
- sugg : ParenthesesInForHeadSugg { left, right } ,
1917
- } ) ;
1918
-
1919
- // Unwrap `(pat)` into `pat` to avoid the `unused_parens` lint.
1920
- pat. and_then ( |pat| match pat. kind {
1921
- PatKind :: Paren ( pat) => pat,
1922
- _ => P ( pat) ,
1923
- } )
1924
- }
1925
- _ => pat,
1926
- }
1927
- }
1928
-
1929
1898
pub ( super ) fn recover_seq_parse_error (
1930
1899
& mut self ,
1931
1900
delim : Delimiter ,
0 commit comments