Skip to content
Myr

update output condition check to use .map

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by knidarkness · committed by David Peter · parent 34eb150 · Browse files · 1 file+16 added−26 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+16 added−26 removed

  • other:+16 added−26 removed

1 file+16 added−26 removed

modified:src/hyperfine/benchmark.rs+16 added-26 removed
139 unmodified lines
140 times_user.push(r.time_user);141 times_system.push(r.time_system);142 }143 }144 if let Some(ref bar) = progress_bar {145 bar.inc(1);146 }144145 progress_bar.as_ref().map(|bar| bar.inc(1));146 }148 if let Some(ref bar) = progress_bar {149 bar.finish_and_clear();150 }147148 progress_bar.as_ref().map(|bar| bar.finish_and_clear());149 150 Ok(TimingResult {151 time_real: mean(&times_real),152 time_user: mean(&times_user),153 time_system: mean(&times_system),
96 unmodified lines
250 options.show_output,251 options.failure_action,252 None,253 )?;256 if let Some(ref pbar) = progress_bar {257 pbar.inc(1);258 }254 progress_bar.as_ref().map(|bar| bar.inc(1));255 256 }260 if let Some(ref bar) = progress_bar {261 bar.finish_and_clear();262 }257 progress_bar.as_ref().map(|bar| bar.finish_and_clear());258 259 }260261 // Set up progress bar (and spinner for initial measurement)262 let progress_bar = if options.output_style != OutputStyleOption::Disabled {
42 unmodified lines
305306 all_succeeded = all_succeeded && success;307308 // Re-configure the progress bar313 if let Some(ref bar) = progress_bar {314 bar.set_length(count);315 bar.inc(1);316 }317309 progress_bar.as_ref().map(|bar| bar.set_length(count));310 progress_bar.as_ref().map(|bar| bar.inc(1));311 312 // Gather statistics313 for _ in 0..count_remaining {314 run_preparation_command(&options.shell, &prepare_cmd, options.show_output)?;315
1 unmodified line
317 let mean = format_duration(mean(&times_real), options.time_unit);318 format!("Current estimate: {}", mean.to_string().green())319 };320327 if let Some(ref bar) = progress_bar {328 bar.set_message(&msg);329 }321 progress_bar.as_ref().map(|bar| bar.set_message(&msg));322323 let (res, success) = time_shell_command(324 &options.shell,325 cmd,
7 unmodified lines
333 times_system.push(res.time_system);334335 all_succeeded = all_succeeded && success;336345 if let Some(ref bar) = progress_bar {346 bar.inc(1);347 }337 progress_bar.as_ref().map(|bar| bar.inc(1));338 }349 if let Some(ref bar) = progress_bar {350 bar.finish_and_clear();351 }339340 progress_bar.as_ref().map(|bar| bar.finish_and_clear());341342343 // Compute statistical quantities344 let t_num = times_real.len();345 let t_mean = mean(&times_real);346 let t_stddev = standard_deviation(&times_real, Some(t_mean));
95 unmodified lines