From 5fb9ca3c5e34a0ad4e4770ea475d75b26e201b61 Mon Sep 17 00:00:00 2001 From: ozkanonur Date: Tue, 10 Jan 2023 10:56:17 +0300 Subject: create helper function for `rustc_lint_defs::Level` and remove it's duplicated code r=ozkanonur Signed-off-by: ozkanonur --- compiler/rustc_errors/src/diagnostic_impls.rs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'compiler/rustc_errors/src') diff --git a/compiler/rustc_errors/src/diagnostic_impls.rs b/compiler/rustc_errors/src/diagnostic_impls.rs index 794b6efcc2b..dad5e98aac0 100644 --- a/compiler/rustc_errors/src/diagnostic_impls.rs +++ b/compiler/rustc_errors/src/diagnostic_impls.rs @@ -179,16 +179,7 @@ impl IntoDiagnosticArg for type_ir::FloatTy { impl IntoDiagnosticArg for Level { fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> { - DiagnosticArgValue::Str(Cow::Borrowed(match self { - Level::Allow => "-A", - Level::Warn => "-W", - Level::ForceWarn(_) => "--force-warn", - Level::Deny => "-D", - Level::Forbid => "-F", - Level::Expect(_) => { - unreachable!("lints with the level of `expect` should not run this code"); - } - })) + DiagnosticArgValue::Str(Cow::Borrowed(self.to_cmd_flag())) } } -- cgit 1.4.1-3-g733a5