diff options
| author | Weihang Lo <me@weihanglo.tw> | 2023-08-28 20:28:51 +0100 |
|---|---|---|
| committer | Weihang Lo <me@weihanglo.tw> | 2023-08-30 19:24:44 +0100 |
| commit | a11805ae46b23d1cc80f7332417cb809ff1c6d64 (patch) | |
| tree | 21f88a78624a0b3f87cc3a9d7dc7303e8c971192 /compiler/rustc_lint/src/errors.rs | |
| parent | cdbad43aba4805ca67de043dd74f617ce5f982a4 (diff) | |
| download | rust-a11805ae46b23d1cc80f7332417cb809ff1c6d64.tar.gz rust-a11805ae46b23d1cc80f7332417cb809ff1c6d64.zip | |
feat(rustc_lint): make `CheckLintName` respect lint level
Diffstat (limited to 'compiler/rustc_lint/src/errors.rs')
| -rw-r--r-- | compiler/rustc_lint/src/errors.rs | 54 |
1 files changed, 1 insertions, 53 deletions
diff --git a/compiler/rustc_lint/src/errors.rs b/compiler/rustc_lint/src/errors.rs index 607875b3faa..eccea35c702 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}; @@ -102,29 +100,6 @@ pub struct UnsupportedGroup { pub lint_group: String, } -pub struct CheckNameUnknown<'a> { - pub lint_name: &'a str, - pub suggestion: Option<Symbol>, - pub sub: RequestedLevel<'a>, -} - -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<'a> { @@ -132,30 +107,3 @@ pub struct CheckNameUnknownTool<'a> { #[subdiagnostic] pub sub: RequestedLevel<'a>, } - -#[derive(Diagnostic)] -#[diag(lint_check_name_renamed)] -pub struct CheckNameRenamed<'a> { - pub lint_name: &'a str, - pub replace: &'a str, - #[subdiagnostic] - pub sub: RequestedLevel<'a>, -} - -#[derive(Diagnostic)] -#[diag(lint_check_name_removed)] -pub struct CheckNameRemoved<'a> { - pub lint_name: &'a str, - pub reason: &'a str, - #[subdiagnostic] - pub sub: RequestedLevel<'a>, -} - -#[derive(Diagnostic)] -#[diag(lint_check_name_deprecated)] -pub struct CheckNameDeprecated<'a> { - pub lint_name: &'a str, - pub new_name: &'a str, - #[subdiagnostic] - pub sub: RequestedLevel<'a>, -} |
