Skip to content
Myr

Auto-fix clippy warnings

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

authored by David Peter · committed by David Peter · parent 489e30c · Browse files · 6 files+17 added−20 removed
This commit

State

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

Diff stats

6 files+17 added−20 removed

  • other:+17 added−20 removed

6 files+17 added−20 removed

modified:src/hyperfine/export/mod.rs+1 added-1 removed
73 unmodified lines
7475 /// Write the given results to all Exporters contained within this manager76 pub fn write_results(&self, results: &[BenchmarkResult], unit: Option<Unit>) -> Result<()> {77 for e in &self.exporters {78 let file_content = e.exporter.serialize(&results, unit)?;78 let file_content = e.exporter.serialize(results, unit)?;79 write_to_file(&e.filename, &file_content)?;80 }81 Ok(())82 }
7 unmodified lines
modified:src/hyperfine/benchmark.rs+10 added-11 removed
145 unmodified lines
146 times_system.push(r.time_system);147 }148 }149150 progress_bar.as_ref().map(|bar| bar.inc(1));150 if let Some(bar) = progress_bar.as_ref() { bar.inc(1) }151 }152153 progress_bar.as_ref().map(|bar| bar.finish_and_clear());153 if let Some(bar) = progress_bar.as_ref() { bar.finish_and_clear() }154155 Ok(TimingResult {156 time_real: mean(&times_real),157 time_user: mean(&times_user),
117 unmodified lines
275 options.show_output,276 options.failure_action,277 None,278 )?;279 progress_bar.as_ref().map(|bar| bar.inc(1));279 if let Some(bar) = progress_bar.as_ref() { bar.inc(1) }280 }281 progress_bar.as_ref().map(|bar| bar.finish_and_clear());281 if let Some(bar) = progress_bar.as_ref() { bar.finish_and_clear() }282 }283284 // Set up progress bar (and spinner for initial measurement)285 let progress_bar = if options.output_style != OutputStyleOption::Disabled {
44 unmodified lines
330331 all_succeeded = all_succeeded && success;332333 // Re-configure the progress bar334 progress_bar.as_ref().map(|bar| bar.set_length(count));335 progress_bar.as_ref().map(|bar| bar.inc(1));334 if let Some(bar) = progress_bar.as_ref() { bar.set_length(count) }335 if let Some(bar) = progress_bar.as_ref() { bar.inc(1) }336337 // Gather statistics338 for _ in 0..count_remaining {339 run_preparation_command(&options.shell, &prepare_cmd, options.show_output)?;
2 unmodified lines
342 let mean = format_duration(mean(&times_real), options.time_unit);343 format!("Current estimate: {}", mean.to_string().green())344 };345346 progress_bar347 .as_ref()348 .map(|bar| bar.set_message(msg.to_owned()));346 if let Some(bar) = progress_bar347 .as_ref() { bar.set_message(msg.to_owned()) }348349 let (res, status) = time_shell_command(350 &options.shell,351 cmd,
9 unmodified lines
361 exit_codes.push(extract_exit_code(status));362363 all_succeeded = all_succeeded && success;364366 progress_bar.as_ref().map(|bar| bar.inc(1));365 if let Some(bar) = progress_bar.as_ref() { bar.inc(1) }366 }367369 progress_bar.as_ref().map(|bar| bar.finish_and_clear());368 if let Some(bar) = progress_bar.as_ref() { bar.finish_and_clear() }369370 // Compute statistical quantities371 let t_num = times_real.len();372 let t_mean = mean(&times_real);
95 unmodified lines
modified:src/hyperfine/internal.rs+1 added-1 removed
103 unmodified lines
104 if results.len() < 2 {105 return;106 }107108 if let Some(mut annotated_results) = compute_relative_speed(&results) {108 if let Some(mut annotated_results) = compute_relative_speed(results) {109 annotated_results.sort_by(|l, r| compare_mean_time(l.result, r.result));110111 let fastest = &annotated_results[0];112 let others = &annotated_results[1..];
142 unmodified lines
modified:src/hyperfine/parameter_range.rs+1 added-2 removed
116 unmodified lines
117 for value in param_range {118 for cmd in &command_strings {119 let name = command_names120 .get(i)121 .or_else(|| command_names.get(0))122 .map(|s| *s);121 .or_else(|| command_names.get(0)).copied();122 commands.push(Command::new_parametrized(123 name,124 cmd,125 vec![(param_name, ParameterValue::Numeric(value.into()))],
188 unmodified lines
modified:src/hyperfine/types.rs+1 added-1 removed
136 unmodified lines
137 // should not ever run 'echo baz baz'. See `test_get_shell_command_nonoverlapping`.138 'outer: while let Some(head) = remaining.chars().next() {139 for (k, v) in &replacements {140 if remaining.starts_with(k.as_str()) {141 result.push_str(&v);141 result.push_str(v);142 remaining = &remaining[k.len()..];143 continue 'outer;144 }145 }
210 unmodified lines
modified:src/main.rs+3 added-4 removed
76 unmodified lines
77 Err(ref e) => error(&e.to_string()),78 };7980 let res = match options {81 Ok(ref opts) => run(&commands, &opts, &export_manager),81 Ok(ref opts) => run(&commands, opts, &export_manager),82 Err(ref e) => error(&e.to_string()),83 };8485 match res {
183 unmodified lines
269 let mut index = vec![0usize; dimensions.len()];270 'outer: loop {271 let name = command_names272 .get(i)273 .or_else(|| command_names.get(0))274 .map(|s| *s);273 .or_else(|| command_names.get(0)).copied();274 i += 1;275276 let (command_index, params_indices) = index.split_first().unwrap();277 let parameters = param_names_and_values
29 unmodified lines
307308 let command_list = command_strings.collect::<Vec<&str>>();309 let mut commands = Vec::with_capacity(command_list.len());310 for (i, s) in command_list.iter().enumerate() {312 commands.push(Command::new(command_names.get(i).copied(), &s));311 commands.push(Command::new(command_names.get(i).copied(), s));312 }313 commands314 }315}
90 unmodified lines