Account for (pat if expr) => {}
When encountering match arm (pat if expr) => {}, recover and suggest removing parentheses. Fix #100825.
This commit is contained in:
parent
db39068ad7
commit
c47318983b
5 changed files with 132 additions and 47 deletions
|
@ -1281,6 +1281,24 @@ pub(crate) struct ParenthesesInForHeadSugg {
|
|||
pub right: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(parse_unexpected_parentheses_in_match_arm_pattern)]
|
||||
pub(crate) struct ParenthesesInMatchPat {
|
||||
#[primary_span]
|
||||
pub span: Vec<Span>,
|
||||
#[subdiagnostic]
|
||||
pub sugg: ParenthesesInMatchPatSugg,
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[multipart_suggestion(parse_suggestion, applicability = "machine-applicable")]
|
||||
pub(crate) struct ParenthesesInMatchPatSugg {
|
||||
#[suggestion_part(code = "")]
|
||||
pub left: Span,
|
||||
#[suggestion_part(code = "")]
|
||||
pub right: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(parse_doc_comment_on_param_type)]
|
||||
pub(crate) struct DocCommentOnParamType {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue