diff options
Diffstat (limited to 'compiler/rustc_lint_defs/src/lib.rs')
| -rw-r--r-- | compiler/rustc_lint_defs/src/lib.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/compiler/rustc_lint_defs/src/lib.rs b/compiler/rustc_lint_defs/src/lib.rs index aa54b3d8ac2..f4b4c5168bf 100644 --- a/compiler/rustc_lint_defs/src/lib.rs +++ b/compiler/rustc_lint_defs/src/lib.rs @@ -253,6 +253,19 @@ impl Level { } } + pub fn to_cmd_flag(self) -> &'static str { + match self { + 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") + } + } + } + pub fn is_error(self) -> bool { match self { Level::Allow | Level::Expect(_) | Level::Warn | Level::ForceWarn(_) => false, |
