Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit c3a6801

Browse files
committed
migrate: redundant_semicolon.rs
1 parent a42afa0 commit c3a6801

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

compiler/rustc_lint/src/lints.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ use rustc_span::{Span, Symbol};
66

77
use crate::LateContext;
88

9+
#[derive(LintDiagnostic)]
10+
#[diag(lint_redundant_semicolons)]
11+
pub struct RedundantSemicolonsDiag {
12+
pub multiple: bool,
13+
#[suggestion(code = "", applicability = "maybe-incorrect")]
14+
pub suggestion: Span,
15+
}
16+
917
pub struct DropTraitConstraintsDiag<'a> {
1018
pub predicate: Predicate<'a>,
1119
pub tcx: TyCtxt<'a>,

compiler/rustc_lint/src/redundant_semicolon.rs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
use crate::{EarlyContext, EarlyLintPass, LintContext};
1+
#![deny(rustc::untranslatable_diagnostic)]
2+
#![deny(rustc::diagnostic_outside_of_impl)]
3+
use crate::{lints::RedundantSemicolonsDiag, EarlyContext, EarlyLintPass, LintContext};
24
use rustc_ast::{Block, StmtKind};
3-
use rustc_errors::{fluent, Applicability};
45
use rustc_span::Span;
56

67
declare_lint! {
@@ -48,18 +49,10 @@ fn maybe_lint_redundant_semis(cx: &EarlyContext<'_>, seq: &mut Option<(Span, boo
4849
return;
4950
}
5051

51-
cx.struct_span_lint(
52+
cx.emit_spanned_lint(
5253
REDUNDANT_SEMICOLONS,
5354
span,
54-
fluent::lint_redundant_semicolons,
55-
|lint| {
56-
lint.set_arg("multiple", multiple).span_suggestion(
57-
span,
58-
fluent::suggestion,
59-
"",
60-
Applicability::MaybeIncorrect,
61-
)
62-
},
55+
RedundantSemicolonsDiag { multiple, suggestion: span },
6356
);
6457
}
6558
}

0 commit comments

Comments
 (0)