Auto-fix clippy warnings

This commit is contained in:
David Peter authored and David Peter committed 2021-08-22 16:33:43 +02:00
1 parent 489e30cbae
commit 85730b3f0f
6 files changed
+17 -20

No files matched your search

+10 -11
View File
@@ -147,10 +147,10 @@ pub fn mean_shell_spawning_time(
}
}
progress_bar.as_ref().map(|bar| bar.inc(1));
if let Some(bar) = progress_bar.as_ref() { bar.inc(1) }
}
progress_bar.as_ref().map(|bar| bar.finish_and_clear());
if let Some(bar) = progress_bar.as_ref() { bar.finish_and_clear() }
Ok(TimingResult {
time_real: mean(&times_real),
@@ -276,9 +276,9 @@ pub fn run_benchmark(
options.failure_action,
None,
)?;
progress_bar.as_ref().map(|bar| bar.inc(1));
if let Some(bar) = progress_bar.as_ref() { bar.inc(1) }
}
progress_bar.as_ref().map(|bar| bar.finish_and_clear());
if let Some(bar) = progress_bar.as_ref() { bar.finish_and_clear() }
}
// Set up progress bar (and spinner for initial measurement)
@@ -331,8 +331,8 @@ pub fn run_benchmark(
all_succeeded = all_succeeded && success;
// Re-configure the progress bar
progress_bar.as_ref().map(|bar| bar.set_length(count));
progress_bar.as_ref().map(|bar| bar.inc(1));
if let Some(bar) = progress_bar.as_ref() { bar.set_length(count) }
if let Some(bar) = progress_bar.as_ref() { bar.inc(1) }
// Gather statistics
for _ in 0..count_remaining {
@@ -343,9 +343,8 @@ pub fn run_benchmark(
format!("Current estimate: {}", mean.to_string().green())
};
progress_bar
.as_ref()
.map(|bar| bar.set_message(msg.to_owned()));
if let Some(bar) = progress_bar
.as_ref() { bar.set_message(msg.to_owned()) }
let (res, status) = time_shell_command(
&options.shell,
@@ -363,10 +362,10 @@ pub fn run_benchmark(
all_succeeded = all_succeeded && success;
progress_bar.as_ref().map(|bar| bar.inc(1));
if let Some(bar) = progress_bar.as_ref() { bar.inc(1) }
}
progress_bar.as_ref().map(|bar| bar.finish_and_clear());
if let Some(bar) = progress_bar.as_ref() { bar.finish_and_clear() }
// Compute statistical quantities
let t_num = times_real.len();
+1 -1
View File
@@ -75,7 +75,7 @@ impl ExportManager {
/// Write the given results to all Exporters contained within this manager
pub fn write_results(&self, results: &[BenchmarkResult], unit: Option<Unit>) -> Result<()> {
for e in &self.exporters {
let file_content = e.exporter.serialize(&results, unit)?;
let file_content = e.exporter.serialize(results, unit)?;
write_to_file(&e.filename, &file_content)?;
}
Ok(())
+1 -1
View File
@@ -105,7 +105,7 @@ pub fn write_benchmark_comparison(results: &[BenchmarkResult]) {
return;
}
if let Some(mut annotated_results) = compute_relative_speed(&results) {
if let Some(mut annotated_results) = compute_relative_speed(results) {
annotated_results.sort_by(|l, r| compare_mean_time(l.result, r.result));
let fastest = &annotated_results[0];
+1 -2
View File
@@ -118,8 +118,7 @@ fn build_parameterized_commands<'a, T: Numeric>(
for cmd in &command_strings {
let name = command_names
.get(i)
.or_else(|| command_names.get(0))
.map(|s| *s);
.or_else(|| command_names.get(0)).copied();
commands.push(Command::new_parametrized(
name,
cmd,
+1 -1
View File
@@ -138,7 +138,7 @@ impl<'a> Command<'a> {
'outer: while let Some(head) = remaining.chars().next() {
for (k, v) in &replacements {
if remaining.starts_with(k.as_str()) {
result.push_str(&v);
result.push_str(v);
remaining = &remaining[k.len()..];
continue 'outer;
}
+3 -4
View File
@@ -78,7 +78,7 @@ fn main() {
};
let res = match options {
Ok(ref opts) => run(&commands, &opts, &export_manager),
Ok(ref opts) => run(&commands, opts, &export_manager),
Err(ref e) => error(&e.to_string()),
};
@@ -270,8 +270,7 @@ fn build_commands<'a>(matches: &'a ArgMatches<'_>) -> Vec<Command<'a>> {
'outer: loop {
let name = command_names
.get(i)
.or_else(|| command_names.get(0))
.map(|s| *s);
.or_else(|| command_names.get(0)).copied();
i += 1;
let (command_index, params_indices) = index.split_first().unwrap();
@@ -309,7 +308,7 @@ fn build_commands<'a>(matches: &'a ArgMatches<'_>) -> Vec<Command<'a>> {
let command_list = command_strings.collect::<Vec<&str>>();
let mut commands = Vec::with_capacity(command_list.len());
for (i, s) in command_list.iter().enumerate() {
commands.push(Command::new(command_names.get(i).copied(), &s));
commands.push(Command::new(command_names.get(i).copied(), s));
}
commands
}