Suggest removing let if const let is used

This commit is contained in:
Obei Sideg 2022-08-03 18:43:29 +03:00
parent dcb444af0a
commit 2af92bbf2e

View File

@ -1124,6 +1124,16 @@ impl<'a> Parser<'a> {
Applicability::MaybeIncorrect,
)
.emit();
} else if self.eat_keyword(kw::Let) {
let span = self.prev_token.span;
self.struct_span_err(const_span.to(span), "`const` and `let` are mutually exclusive")
.span_suggestion(
const_span.to(span),
"remove `let`",
"const",
Applicability::MaybeIncorrect,
)
.emit();
}
}