Fix some clippy warning

This commit is contained in:
Rémi Lauzier 2021-06-11 17:44:11 -04:00 committed by David Peter
parent edc1b4db5c
commit aa162cd886
5 changed files with 10 additions and 12 deletions

View File

@ -16,7 +16,7 @@ fn main() {
}
}
let var = std::env::var_os("SHELL_COMPLETIONS_DIR").or(std::env::var_os("OUT_DIR"));
let var = std::env::var_os("SHELL_COMPLETIONS_DIR").or_else(|| std::env::var_os("OUT_DIR"));
let outdir = match var {
None => return,
Some(outdir) => outdir,

View File

@ -1,4 +1,3 @@
use atty;
use atty::Stream;
use clap::{crate_version, App, AppSettings, Arg, ArgMatches};
use std::ffi::OsString;

View File

@ -29,7 +29,7 @@ pub fn get_progress_bar(length: u64, msg: &str, option: OutputStyleOption) -> Pr
OutputStyleOption::Basic | OutputStyleOption::Color => ProgressBar::hidden(),
_ => ProgressBar::new(length),
};
progress_bar.set_style(progressbar_style.clone());
progress_bar.set_style(progressbar_style);
progress_bar.enable_steady_tick(TICK_SETTINGS.1);
progress_bar.set_message(msg.to_owned());
@ -64,9 +64,9 @@ fn compare_mean_time(l: &BenchmarkResult, r: &BenchmarkResult) -> Ordering {
l.mean.partial_cmp(&r.mean).unwrap_or(Ordering::Equal)
}
pub fn compute_relative_speed<'a>(
results: &'a [BenchmarkResult],
) -> Option<Vec<BenchmarkResultWithRelativeSpeed<'a>>> {
pub fn compute_relative_speed (
results: & [BenchmarkResult],
) -> Option<Vec<BenchmarkResultWithRelativeSpeed>> {
let fastest: &BenchmarkResult = results
.iter()
.min_by(|&l, &r| compare_mean_time(l, r))
@ -188,7 +188,7 @@ fn test_compute_relative_speed_for_zero_times() {
assert!(annotated_results.is_none());
}
pub fn tokenize<'a>(values: &'a str) -> Vec<String> {
pub fn tokenize(values: &str) -> Vec<String> {
let mut tokens = vec![];
let mut buf = String::new();

View File

@ -1,4 +1,3 @@
use std;
use std::io;
use std::process::{Command, ExitStatus, Stdio};

View File

@ -51,10 +51,10 @@ fn get_cpu_times() -> CPUTimes {
const MICROSEC_PER_SEC: i64 = 1000 * 1000;
CPUTimes {
user_usec: i64::from(result.ru_utime.tv_sec) * MICROSEC_PER_SEC
+ i64::from(result.ru_utime.tv_usec),
system_usec: i64::from(result.ru_stime.tv_sec) * MICROSEC_PER_SEC
+ i64::from(result.ru_stime.tv_usec),
user_usec: result.ru_utime.tv_sec * MICROSEC_PER_SEC
+ result.ru_utime.tv_usec,
system_usec: result.ru_stime.tv_sec * MICROSEC_PER_SEC
+ result.ru_stime.tv_usec,
}
}