diff --git a/build.rs b/build.rs index 9b83e35..f413251 100644 --- a/build.rs +++ b/build.rs @@ -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, diff --git a/src/hyperfine/app.rs b/src/hyperfine/app.rs index a715291..1573f13 100644 --- a/src/hyperfine/app.rs +++ b/src/hyperfine/app.rs @@ -1,4 +1,3 @@ -use atty; use atty::Stream; use clap::{crate_version, App, AppSettings, Arg, ArgMatches}; use std::ffi::OsString; diff --git a/src/hyperfine/internal.rs b/src/hyperfine/internal.rs index 5e1aaf0..7139aad 100644 --- a/src/hyperfine/internal.rs +++ b/src/hyperfine/internal.rs @@ -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>> { +pub fn compute_relative_speed ( + results: & [BenchmarkResult], +) -> Option> { 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 { +pub fn tokenize(values: &str) -> Vec { let mut tokens = vec![]; let mut buf = String::new(); diff --git a/src/hyperfine/shell.rs b/src/hyperfine/shell.rs index 48162fe..6bb3ec0 100644 --- a/src/hyperfine/shell.rs +++ b/src/hyperfine/shell.rs @@ -1,4 +1,3 @@ -use std; use std::io; use std::process::{Command, ExitStatus, Stdio}; diff --git a/src/hyperfine/timer/unix_timer.rs b/src/hyperfine/timer/unix_timer.rs index f65b207..802be5d 100644 --- a/src/hyperfine/timer/unix_timer.rs +++ b/src/hyperfine/timer/unix_timer.rs @@ -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, } }