Auto merge of #101362 - compiler-errors:unnecessary-let, r=cjgillot

Suggest removing unnecessary prefix let in patterns

Helps with #101291, though I think `@estebank` probably wants this:

> Finally, I think it'd be nice if we could detect that we don't know for sure and "just" swallow the rest of the expression (find the next ; accounting for nested braces) or the end of the item (easier).

... to be implemented before we close that issue out completely.
This commit is contained in:
bors 2022-09-06 08:49:54 +00:00
commit a594044533
6 changed files with 74 additions and 1 deletions

View file

@ -705,6 +705,14 @@ pub(crate) struct LeftArrowOperator {
pub span: Span,
}
#[derive(SessionDiagnostic)]
#[diag(parser::remove_let)]
pub(crate) struct RemoveLet {
#[primary_span]
#[suggestion(applicability = "machine-applicable", code = "")]
pub span: Span,
}
// SnapshotParser is used to create a snapshot of the parser
// without causing duplicate errors being emitted when the `Parser`
// is dropped.