@@ -366,24 +366,17 @@ impl<'hir> LoweringContext<'_, 'hir> {
366366 fn if_let_expr_with_parens ( & mut self , cond : & Expr , paren : & Expr ) {
367367 let start = cond. span . until ( paren. span ) ;
368368 let end = paren. span . shrink_to_hi ( ) . until ( cond. span . shrink_to_hi ( ) ) ;
369- let mut err = self . sess . struct_span_err (
370- vec ! [ start, end] ,
371- "invalid parentheses around `let` expression in `if let`" ,
372- ) ;
373- if self . sess . opts . unstable_features . is_nightly_build ( ) {
374- err. note (
375- "only supported directly without parentheses in conditions of `if`- and \
376- `while`-expressions, as well as in `let` chains within parentheses",
377- ) ;
378- } else {
379- err. note ( "variable declaration using `let` is a statement, not a condition" ) ;
380- }
381- err. multipart_suggestion (
382- "`if let` needs to be written without parentheses" ,
383- vec ! [ ( start, String :: new( ) ) , ( end, String :: new( ) ) ] ,
384- rustc_errors:: Applicability :: MachineApplicable ,
385- ) ;
386- err. emit ( ) ;
369+ self . sess
370+ . struct_span_err (
371+ vec ! [ start, end] ,
372+ "invalid parentheses around `let` expression in `if let`" ,
373+ )
374+ . multipart_suggestion (
375+ "`if let` needs to be written without parentheses" ,
376+ vec ! [ ( start, String :: new( ) ) , ( end, String :: new( ) ) ] ,
377+ rustc_errors:: Applicability :: MachineApplicable ,
378+ )
379+ . emit ( ) ;
387380 // Ideally, we'd remove the feature gating of a `let` expression since we are already
388381 // complaining about it here, but `feature_gate::check_crate` has already run by now:
389382 // self.sess.parse_sess.gated_spans.ungate_last(sym::let_chains, paren.span);
0 commit comments