create helper function for rustc_lint_defs::Level
and remove it's duplicated code r=ozkanonur
Signed-off-by: ozkanonur <work@onurozkan.dev>
This commit is contained in:
parent
89e0576bd3
commit
5fb9ca3c5e
3 changed files with 15 additions and 20 deletions
|
@ -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()))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue