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
|
@ -234,16 +234,7 @@ pub fn explain_lint_level_source(
|
|||
err.note_once(&format!("`#[{}({})]` on by default", level.as_str(), name));
|
||||
}
|
||||
LintLevelSource::CommandLine(lint_flag_val, orig_level) => {
|
||||
let flag = match orig_level {
|
||||
Level::Warn => "-W",
|
||||
Level::Deny => "-D",
|
||||
Level::Forbid => "-F",
|
||||
Level::Allow => "-A",
|
||||
Level::ForceWarn(_) => "--force-warn",
|
||||
Level::Expect(_) => {
|
||||
unreachable!("the expect level does not have a commandline flag")
|
||||
}
|
||||
};
|
||||
let flag = orig_level.to_cmd_flag();
|
||||
let hyphen_case_lint_name = name.replace('_', "-");
|
||||
if lint_flag_val.as_str() == name {
|
||||
err.note_once(&format!(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue