mirror of
https://github.com/rust-lang/cargo
synced 2024-10-13 19:22:33 +00:00
refactor(toml): Inline TomlLintLevel::flag
This commit is contained in:
parent
d8b9b992dd
commit
a774d8b025
|
@ -1331,7 +1331,13 @@ fn lints_to_rustflags(lints: &schema::TomlLints) -> Vec<String> {
|
|||
.iter()
|
||||
.flat_map(|(tool, lints)| {
|
||||
lints.iter().map(move |(name, config)| {
|
||||
let flag = config.level().flag();
|
||||
let flag = match config.level() {
|
||||
schema::TomlLintLevel::Forbid => "--forbid",
|
||||
schema::TomlLintLevel::Deny => "--deny",
|
||||
schema::TomlLintLevel::Warn => "--warn",
|
||||
schema::TomlLintLevel::Allow => "--allow",
|
||||
};
|
||||
|
||||
let option = if tool == "rust" {
|
||||
format!("{flag}={name}")
|
||||
} else {
|
||||
|
@ -2261,17 +2267,6 @@ impl schema::InheritableLints {
|
|||
}
|
||||
}
|
||||
|
||||
impl schema::TomlLintLevel {
|
||||
fn flag(&self) -> &'static str {
|
||||
match self {
|
||||
Self::Forbid => "--forbid",
|
||||
Self::Deny => "--deny",
|
||||
Self::Warn => "--warn",
|
||||
Self::Allow => "--allow",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub trait ResolveToPath {
|
||||
fn resolve(&self, config: &Config) -> PathBuf;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue