summary refs log tree commit diff
path: root/compiler/rustc_ast_lowering/src/expr.rs
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2021-03-07 15:03:46 -0800
committerEsteban Küber <esteban@kuber.com.ar>2021-03-07 15:03:46 -0800
commitaa7ac6e957747c0fc2edae126162bdfd8faff69c (patch)
tree8f0c16367efd250fe3eaeef6bc676e1c0b640cfe /compiler/rustc_ast_lowering/src/expr.rs
parent63fb294a7455b76ecfbef6831410e5362ee9d514 (diff)
downloadrust-aa7ac6e957747c0fc2edae126162bdfd8faff69c.tar.gz
rust-aa7ac6e957747c0fc2edae126162bdfd8faff69c.zip
Remove notes, increase S/N ratio
Diffstat (limited to 'compiler/rustc_ast_lowering/src/expr.rs')
-rw-r--r--compiler/rustc_ast_lowering/src/expr.rs29
1 files changed, 11 insertions, 18 deletions
diff --git a/compiler/rustc_ast_lowering/src/expr.rs b/compiler/rustc_ast_lowering/src/expr.rs
index 63fc4e0ceda..c9a5541585f 100644
--- a/compiler/rustc_ast_lowering/src/expr.rs
+++ b/compiler/rustc_ast_lowering/src/expr.rs
@@ -366,24 +366,17 @@ impl<'hir> LoweringContext<'_, 'hir> {
     fn if_let_expr_with_parens(&mut self, cond: &Expr, paren: &Expr) {
         let start = cond.span.until(paren.span);
         let end = paren.span.shrink_to_hi().until(cond.span.shrink_to_hi());
-        let mut err = self.sess.struct_span_err(
-            vec![start, end],
-            "invalid parentheses around `let` expression in `if let`",
-        );
-        if self.sess.opts.unstable_features.is_nightly_build() {
-            err.note(
-                "only supported directly without parentheses in conditions of `if`- and \
-                 `while`-expressions, as well as in `let` chains within parentheses",
-            );
-        } else {
-            err.note("variable declaration using `let` is a statement, not a condition");
-        }
-        err.multipart_suggestion(
-            "`if let` needs to be written without parentheses",
-            vec![(start, String::new()), (end, String::new())],
-            rustc_errors::Applicability::MachineApplicable,
-        );
-        err.emit();
+        self.sess
+            .struct_span_err(
+                vec![start, end],
+                "invalid parentheses around `let` expression in `if let`",
+            )
+            .multipart_suggestion(
+                "`if let` needs to be written without parentheses",
+                vec![(start, String::new()), (end, String::new())],
+                rustc_errors::Applicability::MachineApplicable,
+            )
+            .emit();
         // Ideally, we'd remove the feature gating of a `let` expression since we are already
         // complaining about it here, but `feature_gate::check_crate` has already run by now:
         // self.sess.parse_sess.gated_spans.ungate_last(sym::let_chains, paren.span);