Unconditionally deny warnings for clippy

This commit is contained in:
datdenkikniet 2023-04-16 11:51:28 +02:00
parent fd011cd5ec
commit 4d3361658b
2 changed files with 20 additions and 2 deletions

View file

@ -65,6 +65,7 @@ pub enum CargoCommand<'a> {
package: Option<String>, package: Option<String>,
target: Option<Target<'a>>, target: Option<Target<'a>>,
features: Option<String>, features: Option<String>,
deny_warnings: bool,
}, },
Format { Format {
cargoarg: &'a Option<&'a str>, cargoarg: &'a Option<&'a str>,
@ -244,10 +245,16 @@ impl core::fmt::Display for CargoCommand<'_> {
package, package,
target, target,
features, features,
deny_warnings,
} => { } => {
let details = details(target, None, features, cargoarg, None); let details = details(target, None, features, cargoarg, None);
let package = p(package); let package = p(package);
write!(f, "Clippy {package} {details}") let deny_warns = if *deny_warnings {
format!(" (deny warnings)")
} else {
format!("")
};
write!(f, "Clippy{deny_warns} {package} {details}")
} }
CargoCommand::Format { CargoCommand::Format {
cargoarg, cargoarg,
@ -483,9 +490,19 @@ impl<'a> CargoCommand<'a> {
cargoarg, cargoarg,
package, package,
features, features,
deny_warnings,
// Target is added by build_args // Target is added by build_args
target: _, target: _,
} => self.build_args(true, cargoarg, features, None, p(package)), } => {
let package = p(package);
let extra = if *deny_warnings {
vec!["--", "-D", "warnings"].into_iter()
} else {
vec![].into_iter()
};
self.build_args(true, cargoarg, features, None, package.chain(extra))
}
CargoCommand::Doc { CargoCommand::Doc {
cargoarg, cargoarg,
features, features,

View file

@ -279,6 +279,7 @@ pub fn cargo_clippy<'c>(
package: Some(package.name()), package: Some(package.name()),
target: target.into(), target: target.into(),
features, features,
deny_warnings: true,
}; };
(globals, command, false) (globals, command, false)