1
Fork 0

Make the "extra if in let...else block" hint a suggestion

This commit is contained in:
Edward Shen 2023-01-30 14:09:40 -08:00
parent f55b0022db
commit e905b93706
No known key found for this signature in database
GPG key ID: D6A2AC5596760EE9
4 changed files with 8 additions and 8 deletions

View file

@ -351,7 +351,7 @@ pub(crate) enum IfExpressionMissingThenBlockSub {
}
#[derive(Subdiagnostic)]
#[help(parse_extra_if_in_let_else)]
#[suggestion(parse_extra_if_in_let_else, applicability = "maybe-incorrect", code = "")]
pub(crate) struct IfExpressionLetSomeSub {
#[primary_span]
pub if_span: Span,

View file

@ -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,