mirror of
https://github.com/sharkdp/hyperfine.git
synced 2024-12-01 21:54:05 +03:00
Fix some clippy warning
This commit is contained in:
parent
edc1b4db5c
commit
aa162cd886
2
build.rs
2
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 {
|
let outdir = match var {
|
||||||
None => return,
|
None => return,
|
||||||
Some(outdir) => outdir,
|
Some(outdir) => outdir,
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
use atty;
|
|
||||||
use atty::Stream;
|
use atty::Stream;
|
||||||
use clap::{crate_version, App, AppSettings, Arg, ArgMatches};
|
use clap::{crate_version, App, AppSettings, Arg, ArgMatches};
|
||||||
use std::ffi::OsString;
|
use std::ffi::OsString;
|
||||||
|
@ -29,7 +29,7 @@ pub fn get_progress_bar(length: u64, msg: &str, option: OutputStyleOption) -> Pr
|
|||||||
OutputStyleOption::Basic | OutputStyleOption::Color => ProgressBar::hidden(),
|
OutputStyleOption::Basic | OutputStyleOption::Color => ProgressBar::hidden(),
|
||||||
_ => ProgressBar::new(length),
|
_ => 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.enable_steady_tick(TICK_SETTINGS.1);
|
||||||
progress_bar.set_message(msg.to_owned());
|
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)
|
l.mean.partial_cmp(&r.mean).unwrap_or(Ordering::Equal)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn compute_relative_speed<'a>(
|
pub fn compute_relative_speed (
|
||||||
results: &'a [BenchmarkResult],
|
results: & [BenchmarkResult],
|
||||||
) -> Option<Vec<BenchmarkResultWithRelativeSpeed<'a>>> {
|
) -> Option<Vec<BenchmarkResultWithRelativeSpeed>> {
|
||||||
let fastest: &BenchmarkResult = results
|
let fastest: &BenchmarkResult = results
|
||||||
.iter()
|
.iter()
|
||||||
.min_by(|&l, &r| compare_mean_time(l, r))
|
.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());
|
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 tokens = vec![];
|
||||||
let mut buf = String::new();
|
let mut buf = String::new();
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
use std;
|
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::process::{Command, ExitStatus, Stdio};
|
use std::process::{Command, ExitStatus, Stdio};
|
||||||
|
|
||||||
|
@ -51,10 +51,10 @@ fn get_cpu_times() -> CPUTimes {
|
|||||||
const MICROSEC_PER_SEC: i64 = 1000 * 1000;
|
const MICROSEC_PER_SEC: i64 = 1000 * 1000;
|
||||||
|
|
||||||
CPUTimes {
|
CPUTimes {
|
||||||
user_usec: i64::from(result.ru_utime.tv_sec) * MICROSEC_PER_SEC
|
user_usec: result.ru_utime.tv_sec * MICROSEC_PER_SEC
|
||||||
+ i64::from(result.ru_utime.tv_usec),
|
+ result.ru_utime.tv_usec,
|
||||||
system_usec: i64::from(result.ru_stime.tv_sec) * MICROSEC_PER_SEC
|
system_usec: result.ru_stime.tv_sec * MICROSEC_PER_SEC
|
||||||
+ i64::from(result.ru_stime.tv_usec),
|
+ result.ru_stime.tv_usec,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user