mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-27 14:04:56 +01:00
Also always deny warnings for doc
This commit is contained in:
parent
799e5bf357
commit
85e2cd6d4b
2 changed files with 24 additions and 13 deletions
|
@ -81,6 +81,7 @@ pub enum CargoCommand<'a> {
|
||||||
cargoarg: &'a Option<&'a str>,
|
cargoarg: &'a Option<&'a str>,
|
||||||
features: Option<String>,
|
features: Option<String>,
|
||||||
arguments: Option<ExtraArguments>,
|
arguments: Option<ExtraArguments>,
|
||||||
|
deny_warnings: bool,
|
||||||
},
|
},
|
||||||
Test {
|
Test {
|
||||||
package: Option<String>,
|
package: Option<String>,
|
||||||
|
@ -297,6 +298,7 @@ impl core::fmt::Display for CargoCommand<'_> {
|
||||||
cargoarg,
|
cargoarg,
|
||||||
features,
|
features,
|
||||||
arguments,
|
arguments,
|
||||||
|
deny_warnings,
|
||||||
} => {
|
} => {
|
||||||
let feat = feat(features);
|
let feat = feat(features);
|
||||||
let carg = carg(cargoarg);
|
let carg = carg(cargoarg);
|
||||||
|
@ -304,10 +306,15 @@ impl core::fmt::Display for CargoCommand<'_> {
|
||||||
.clone()
|
.clone()
|
||||||
.map(|a| format!("{a}"))
|
.map(|a| format!("{a}"))
|
||||||
.unwrap_or_else(|| "no extra arguments".into());
|
.unwrap_or_else(|| "no extra arguments".into());
|
||||||
if cargoarg.is_some() {
|
let deny_warnings = if *deny_warnings {
|
||||||
write!(f, "Document ({feat}, {carg}, {arguments})")
|
format!("deny warnings, ")
|
||||||
} else {
|
} else {
|
||||||
write!(f, "Document ({feat}, {arguments})")
|
format!("")
|
||||||
|
};
|
||||||
|
if cargoarg.is_some() {
|
||||||
|
write!(f, "Document ({deny_warnings}{feat}, {carg}, {arguments})")
|
||||||
|
} else {
|
||||||
|
write!(f, "Document ({deny_warnings}{feat}, {arguments})")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CargoCommand::Test {
|
CargoCommand::Test {
|
||||||
|
@ -482,7 +489,7 @@ impl<'a> CargoCommand<'a> {
|
||||||
dir: _,
|
dir: _,
|
||||||
// Target is added by build_args
|
// Target is added by build_args
|
||||||
target: _,
|
target: _,
|
||||||
// deny_warnings is exposed through `rustflags`
|
// deny_warnings is exposed through `extra_env`
|
||||||
deny_warnings: _,
|
deny_warnings: _,
|
||||||
} => self.build_args(
|
} => self.build_args(
|
||||||
true,
|
true,
|
||||||
|
@ -500,7 +507,7 @@ impl<'a> CargoCommand<'a> {
|
||||||
target: _,
|
target: _,
|
||||||
// Dir is exposed through `chdir`
|
// Dir is exposed through `chdir`
|
||||||
dir: _,
|
dir: _,
|
||||||
// deny_warnings is exposed through `rustflags`
|
// deny_warnings is exposed through `extra_env`
|
||||||
deny_warnings: _,
|
deny_warnings: _,
|
||||||
} => self.build_args(true, cargoarg, features, Some(mode), p(package)),
|
} => self.build_args(true, cargoarg, features, Some(mode), p(package)),
|
||||||
CargoCommand::Check {
|
CargoCommand::Check {
|
||||||
|
@ -512,7 +519,7 @@ impl<'a> CargoCommand<'a> {
|
||||||
dir: _,
|
dir: _,
|
||||||
// Target is added by build_args
|
// Target is added by build_args
|
||||||
target: _,
|
target: _,
|
||||||
// deny_warnings is exposed through `rustflags`
|
// deny_warnings is exposed through `extra_env`
|
||||||
deny_warnings: _,
|
deny_warnings: _,
|
||||||
} => self.build_args(true, cargoarg, features, Some(mode), p(package)),
|
} => self.build_args(true, cargoarg, features, Some(mode), p(package)),
|
||||||
CargoCommand::Clippy {
|
CargoCommand::Clippy {
|
||||||
|
@ -536,6 +543,8 @@ impl<'a> CargoCommand<'a> {
|
||||||
cargoarg,
|
cargoarg,
|
||||||
features,
|
features,
|
||||||
arguments,
|
arguments,
|
||||||
|
// deny_warnings is exposed through `extra_env`
|
||||||
|
deny_warnings: _,
|
||||||
} => {
|
} => {
|
||||||
let extra = Self::extra_args(arguments.as_ref());
|
let extra = Self::extra_args(arguments.as_ref());
|
||||||
self.build_args(true, cargoarg, features, None, extra)
|
self.build_args(true, cargoarg, features, None, extra)
|
||||||
|
@ -544,7 +553,7 @@ impl<'a> CargoCommand<'a> {
|
||||||
package,
|
package,
|
||||||
features,
|
features,
|
||||||
test,
|
test,
|
||||||
// deny_warnings is exposed through `rustflags`
|
// deny_warnings is exposed through `extra_env`
|
||||||
deny_warnings: _,
|
deny_warnings: _,
|
||||||
} => {
|
} => {
|
||||||
let extra = if let Some(test) = test {
|
let extra = if let Some(test) = test {
|
||||||
|
@ -595,7 +604,7 @@ impl<'a> CargoCommand<'a> {
|
||||||
dir: _,
|
dir: _,
|
||||||
// Target is added by build_args
|
// Target is added by build_args
|
||||||
target: _,
|
target: _,
|
||||||
// deny_warnings is exposed through `rustflags`
|
// deny_warnings is exposed through `extra_env`
|
||||||
deny_warnings: _,
|
deny_warnings: _,
|
||||||
} => self.build_args(
|
} => self.build_args(
|
||||||
true,
|
true,
|
||||||
|
@ -611,7 +620,7 @@ impl<'a> CargoCommand<'a> {
|
||||||
mode,
|
mode,
|
||||||
// Target is added by build_args
|
// Target is added by build_args
|
||||||
target: _,
|
target: _,
|
||||||
// deny_warnings is exposed through `rustflags`
|
// deny_warnings is exposed through `extra_env`
|
||||||
deny_warnings: _,
|
deny_warnings: _,
|
||||||
} => self.build_args(
|
} => self.build_args(
|
||||||
true,
|
true,
|
||||||
|
@ -667,11 +676,12 @@ impl<'a> CargoCommand<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn rustflags(&self) -> Option<&str> {
|
pub fn extra_env(&self) -> Option<(&str, &str)> {
|
||||||
match self {
|
match self {
|
||||||
// Clippy is a special case: it sets deny warnings
|
// Clippy is a special case: it sets deny warnings
|
||||||
// through an argument to rustc.
|
// through an argument to rustc.
|
||||||
CargoCommand::Clippy { .. } => None,
|
CargoCommand::Clippy { .. } => None,
|
||||||
|
CargoCommand::Doc { .. } => Some(("RUSTDOCFLAGS", "-D warnings")),
|
||||||
CargoCommand::Check { deny_warnings, .. }
|
CargoCommand::Check { deny_warnings, .. }
|
||||||
| CargoCommand::ExampleCheck { deny_warnings, .. }
|
| CargoCommand::ExampleCheck { deny_warnings, .. }
|
||||||
| CargoCommand::Build { deny_warnings, .. }
|
| CargoCommand::Build { deny_warnings, .. }
|
||||||
|
@ -679,7 +689,7 @@ impl<'a> CargoCommand<'a> {
|
||||||
| CargoCommand::Test { deny_warnings, .. }
|
| CargoCommand::Test { deny_warnings, .. }
|
||||||
| CargoCommand::Qemu { deny_warnings, .. } => {
|
| CargoCommand::Qemu { deny_warnings, .. } => {
|
||||||
if *deny_warnings {
|
if *deny_warnings {
|
||||||
Some("-D warnings")
|
Some(("RUSTFLAGS", "-D warnings"))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
|
@ -328,6 +328,7 @@ pub fn cargo_doc<'c>(
|
||||||
cargoarg,
|
cargoarg,
|
||||||
features,
|
features,
|
||||||
arguments: arguments.clone(),
|
arguments: arguments.clone(),
|
||||||
|
deny_warnings: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
vec![run_and_convert((globals, command, false))]
|
vec![run_and_convert((globals, command, false))]
|
||||||
|
@ -468,8 +469,8 @@ fn run_command(
|
||||||
process.current_dir(dir.canonicalize()?);
|
process.current_dir(dir.canonicalize()?);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(rustflags) = command.rustflags() {
|
if let Some((k, v)) = command.extra_env() {
|
||||||
process.env("RUSTFLAGS", rustflags);
|
process.env(k, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
let result = process.output()?;
|
let result = process.output()?;
|
||||||
|
|
Loading…
Reference in a new issue