1
Fork 0

Migrate some range parsing diagnostics

This commit is contained in:
clubby789 2023-01-28 21:16:50 +00:00
parent 4bfab39f9b
commit c5688794e2
3 changed files with 61 additions and 19 deletions

View file

@ -649,6 +649,48 @@ pub(crate) struct MatchArmBodyWithoutBraces {
pub sub: MatchArmBodyWithoutBracesSugg,
}
#[derive(Diagnostic)]
#[diag(parse_inclusive_range_extra_equals)]
#[note]
pub(crate) struct InclusiveRangeExtraEquals {
#[primary_span]
#[suggestion(
suggestion_remove_eq,
style = "short",
code = "..=",
applicability = "maybe-incorrect"
)]
pub span: Span,
}
#[derive(Diagnostic)]
#[diag(parse_inclusive_range_match_arrow)]
pub(crate) struct InclusiveRangeMatchArrow {
#[primary_span]
pub span: Span,
#[suggestion(
suggestion_add_space,
style = "verbose",
code = " ",
applicability = "machine-applicable"
)]
pub after_pat: Span,
}
#[derive(Diagnostic)]
#[diag(parse_inclusive_range_no_end, code = "E0586")]
#[note]
pub(crate) struct InclusiveRangeNoEnd {
#[primary_span]
#[suggestion(
suggestion_open_range,
code = "..",
applicability = "machine-applicable",
style = "short"
)]
pub span: Span,
}
#[derive(Subdiagnostic)]
pub(crate) enum MatchArmBodyWithoutBracesSugg {
#[multipart_suggestion(suggestion_add_braces, applicability = "machine-applicable")]