Appease clippy

This commit is contained in:
Jakub Beránek 2024-06-20 13:00:12 +02:00
parent c15293407f
commit 3fe4d134dd
3 changed files with 14 additions and 14 deletions

View file

@ -2320,7 +2320,7 @@ impl Step for ErrorIndex {
builder.msg(Kind::Test, compiler.stage, "error-index", compiler.host, compiler.host);
let _time = helpers::timeit(builder);
builder
.run_tracked(BootstrapCommand::from(&mut tool).output_mode(OutputMode::PrintOnFailure));
.run_tracked(BootstrapCommand::from(&mut tool).output_mode(OutputMode::OnlyOnFailure));
drop(guard);
// The tests themselves need to link to std, so make sure it is
// available.

View file

@ -585,8 +585,8 @@ impl Build {
BootstrapCommand::from(submodule_git().args(["diff-index", "--quiet", "HEAD"]))
.allow_failure()
.output_mode(match self.is_verbose() {
true => OutputMode::PrintAll,
false => OutputMode::PrintOutput,
true => OutputMode::All,
false => OutputMode::OnlyOutput,
}),
);
if has_local_modifications {
@ -967,15 +967,15 @@ impl Build {
self.verbose(|| println!("running: {command:?}"));
let output_mode = command.output_mode.unwrap_or_else(|| match self.is_verbose() {
true => OutputMode::PrintAll,
false => OutputMode::PrintOutput,
true => OutputMode::All,
false => OutputMode::OnlyOutput,
});
let (output, print_error): (io::Result<CommandOutput>, bool) = match output_mode {
mode @ (OutputMode::PrintAll | OutputMode::PrintOutput) => (
mode @ (OutputMode::All | OutputMode::OnlyOutput) => (
command.command.status().map(|status| status.into()),
matches!(mode, OutputMode::PrintAll),
matches!(mode, OutputMode::All),
),
OutputMode::PrintOnFailure => (command.command.output().map(|o| o.into()), true),
OutputMode::OnlyOnFailure => (command.command.output().map(|o| o.into()), true),
};
let output = match output {
@ -1026,8 +1026,8 @@ impl Build {
fn run(&self, cmd: &mut Command) {
self.run_cmd(BootstrapCommand::from(cmd).fail_fast().output_mode(
match self.is_verbose() {
true => OutputMode::PrintAll,
false => OutputMode::PrintOutput,
true => OutputMode::All,
false => OutputMode::OnlyOutput,
},
));
}

View file

@ -16,11 +16,11 @@ pub enum BehaviorOnFailure {
pub enum OutputMode {
/// Print both the output (by inheriting stdout/stderr) and also the command itself, if it
/// fails.
PrintAll,
All,
/// Print the output (by inheriting stdout/stderr).
PrintOutput,
OnlyOutput,
/// Suppress the output if the command succeeds, otherwise print the output.
PrintOnFailure,
OnlyOnFailure,
}
/// Wrapper around `std::process::Command`.
@ -46,7 +46,7 @@ impl<'a> BootstrapCommand<'a> {
/// Do not print the output of the command, unless it fails.
pub fn quiet(self) -> Self {
self.output_mode(OutputMode::PrintOnFailure)
self.output_mode(OutputMode::OnlyOnFailure)
}
pub fn output_mode(self, output_mode: OutputMode) -> Self {