summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_lint/src/errors.rs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_lint/src/errors.rs')
-rw-r--r--compiler/rustc_lint/src/errors.rs52
1 files changed, 5 insertions, 47 deletions
diff --git a/compiler/rustc_lint/src/errors.rs b/compiler/rustc_lint/src/errors.rs
index 68167487a..eccea35c7 100644
--- a/compiler/rustc_lint/src/errors.rs
+++ b/compiler/rustc_lint/src/errors.rs
@@ -1,7 +1,5 @@
use crate::fluent_generated as fluent;
-use rustc_errors::{
- AddToDiagnostic, Diagnostic, ErrorGuaranteed, Handler, IntoDiagnostic, SubdiagnosticMessage,
-};
+use rustc_errors::{AddToDiagnostic, Diagnostic, SubdiagnosticMessage};
use rustc_macros::{Diagnostic, Subdiagnostic};
use rustc_session::lint::Level;
use rustc_span::{Span, Symbol};
@@ -91,9 +89,9 @@ pub struct BuiltinEllipsisInclusiveRangePatterns {
#[derive(Subdiagnostic)]
#[note(lint_requested_level)]
-pub struct RequestedLevel {
+pub struct RequestedLevel<'a> {
pub level: Level,
- pub lint_name: String,
+ pub lint_name: &'a str,
}
#[derive(Diagnostic)]
@@ -102,50 +100,10 @@ pub struct UnsupportedGroup {
pub lint_group: String,
}
-pub struct CheckNameUnknown {
- pub lint_name: String,
- pub suggestion: Option<Symbol>,
- pub sub: RequestedLevel,
-}
-
-impl IntoDiagnostic<'_> for CheckNameUnknown {
- fn into_diagnostic(
- self,
- handler: &Handler,
- ) -> rustc_errors::DiagnosticBuilder<'_, ErrorGuaranteed> {
- let mut diag = handler.struct_err(fluent::lint_check_name_unknown);
- diag.code(rustc_errors::error_code!(E0602));
- if let Some(suggestion) = self.suggestion {
- diag.help(fluent::lint_help);
- diag.set_arg("suggestion", suggestion);
- }
- diag.set_arg("lint_name", self.lint_name);
- diag.subdiagnostic(self.sub);
- diag
- }
-}
-
#[derive(Diagnostic)]
#[diag(lint_check_name_unknown_tool, code = "E0602")]
-pub struct CheckNameUnknownTool {
+pub struct CheckNameUnknownTool<'a> {
pub tool_name: Symbol,
#[subdiagnostic]
- pub sub: RequestedLevel,
-}
-
-#[derive(Diagnostic)]
-#[diag(lint_check_name_warning)]
-pub struct CheckNameWarning {
- pub msg: String,
- #[subdiagnostic]
- pub sub: RequestedLevel,
-}
-
-#[derive(Diagnostic)]
-#[diag(lint_check_name_deprecated)]
-pub struct CheckNameDeprecated {
- pub lint_name: String,
- pub new_name: String,
- #[subdiagnostic]
- pub sub: RequestedLevel,
+ pub sub: RequestedLevel<'a>,
}