From e905b937060e3c920d85d1ae09d1e3a9a5f5a190 Mon Sep 17 00:00:00 2001 From: Edward Shen Date: Mon, 30 Jan 2023 14:09:40 -0800 Subject: Make the "extra if in let...else block" hint a suggestion --- compiler/rustc_parse/src/parser/expr.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'compiler/rustc_parse/src/parser') diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index 17d1e200b41..614cc311855 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -2281,7 +2281,7 @@ impl<'a> Parser<'a> { block } else { let let_else_sub = matches!(cond.kind, ExprKind::Let(..)) - .then(|| IfExpressionLetSomeSub { if_span: lo }); + .then(|| IfExpressionLetSomeSub { if_span: lo.until(cond_span) }); self.sess.emit_err(IfExpressionMissingThenBlock { if_span: lo, -- cgit 1.4.1-3-g733a5