diff --git a/src/hyperfine/benchmark.rs b/src/hyperfine/benchmark.rs index 3ece1f9..f7547fd 100644 --- a/src/hyperfine/benchmark.rs +++ b/src/hyperfine/benchmark.rs @@ -90,7 +90,7 @@ pub fn time_shell_command( /// Measure the average shell spawning time pub fn mean_shell_spawning_time( shell: &str, - style: &OutputStyleOption, + style: OutputStyleOption, show_output: bool, ) -> io::Result { const COUNT: u64 = 200; @@ -210,7 +210,7 @@ pub fn run_benchmark( let progress_bar = get_progress_bar( options.warmup_count, "Performing warmup runs", - &options.output_style, + options.output_style, ); for _ in 0..options.warmup_count { @@ -230,7 +230,7 @@ pub fn run_benchmark( let progress_bar = get_progress_bar( options.runs.min, "Initial time measurement", - &options.output_style, + options.output_style, ); // Run init command diff --git a/src/hyperfine/internal.rs b/src/hyperfine/internal.rs index 973a42b..45c7138 100644 --- a/src/hyperfine/internal.rs +++ b/src/hyperfine/internal.rs @@ -11,15 +11,15 @@ use std::iter::Iterator; pub const MIN_EXECUTION_TIME: Second = 5e-3; /// Return a pre-configured progress bar -pub fn get_progress_bar(length: u64, msg: &str, option: &OutputStyleOption) -> ProgressBar { - let progressbar_style = match *option { +pub fn get_progress_bar(length: u64, msg: &str, option: OutputStyleOption) -> ProgressBar { + let progressbar_style = match option { OutputStyleOption::Basic | OutputStyleOption::Color => ProgressStyle::default_bar(), _ => ProgressStyle::default_spinner() .tick_chars("⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏") .template(" {spinner} {msg:<30} {wide_bar} ETA {eta_precise}"), }; - let progress_bar = match *option { + let progress_bar = match option { OutputStyleOption::Basic | OutputStyleOption::Color => ProgressBar::hidden(), _ => ProgressBar::new(length), }; diff --git a/src/hyperfine/units.rs b/src/hyperfine/units.rs index cee9037..09364ea 100644 --- a/src/hyperfine/units.rs +++ b/src/hyperfine/units.rs @@ -14,16 +14,16 @@ pub enum Unit { impl Unit { /// The abbreviation of the Unit. - pub fn short_name(&self) -> String { - match *self { + pub fn short_name(self) -> String { + match self { Unit::Second => String::from("s"), Unit::MilliSecond => String::from("ms"), } } /// Returns the Second value formatted for the Unit. - pub fn format(&self, value: Second) -> String { - match *self { + pub fn format(self, value: Second) -> String { + match self { Unit::Second => format!("{:.3}", value), Unit::MilliSecond => format!("{:.1}", value * 1e3), } diff --git a/src/main.rs b/src/main.rs index 0c56b89..61fc8c0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -32,7 +32,7 @@ fn run( options: &HyperfineOptions, ) -> io::Result> { let shell_spawning_time = - mean_shell_spawning_time(&options.shell, &options.output_style, options.show_output)?; + mean_shell_spawning_time(&options.shell, options.output_style, options.show_output)?; let mut timing_results = vec![];