Skip to content

Commit

Permalink
Appease clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
Kobzol committed Jun 20, 2024
1 parent c152934 commit 3fe4d13
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/bootstrap/src/core/build_steps/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
18 changes: 9 additions & 9 deletions src/bootstrap/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
},
));
}
Expand Down
8 changes: 4 additions & 4 deletions src/bootstrap/src/utils/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand All @@ -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 {
Expand Down

0 comments on commit 3fe4d13

Please sign in to comment.