Run 'cargo fmt'

This commit is contained in:
sharkdp committed 2018-05-22 22:57:51 +02:00
1 parent e6d31f5914
commit 22491e2385
12 files changed
+44 -34

No files matched your search

+8 -6
View File
@@ -1,7 +1,7 @@
use clap::{App, AppSettings, Arg, ArgMatches};
use std::ffi::OsString;
use atty;
use atty::Stream;
use clap::{App, AppSettings, Arg, ArgMatches};
use std::ffi::OsString;
pub fn get_arg_matches<T>(args: T) -> ArgMatches<'static>
where
@@ -122,10 +122,12 @@ fn build_app() -> App<'static, 'static> {
Arg::with_name("show-output")
.long("show-output")
.conflicts_with("style")
.help("Print the stdout and stderr of the benchmark instead of suppressing it. \
This will increase the time it takes for benchmarks to run, \
so it should only be used for debugging purposes or \
when trying to benchmark output speed."),
.help(
"Print the stdout and stderr of the benchmark instead of suppressing it. \
This will increase the time it takes for benchmarks to run, \
so it should only be used for debugging purposes or \
when trying to benchmark output speed.",
),
)
.help_message("Print this help message.")
.version_message("Show version information.")
+6 -6
View File
@@ -4,15 +4,15 @@ use std::process::Stdio;
use colored::*;
use statistical::{mean, standard_deviation};
use hyperfine::format::{format_duration, format_duration_unit};
use hyperfine::internal::{get_progress_bar, max, min, MIN_EXECUTION_TIME};
use hyperfine::outlier_detection::{modified_zscores, OUTLIER_THRESHOLD};
use hyperfine::shell::execute_and_time;
use hyperfine::timer::wallclocktimer::WallClockTimer;
use hyperfine::timer::{TimerStart, TimerStop};
use hyperfine::types::{BenchmarkResult, Command};
use hyperfine::types::{CmdFailureAction, HyperfineOptions, OutputStyleOption, Second};
use hyperfine::warnings::Warnings;
use hyperfine::format::{format_duration, format_duration_unit};
use hyperfine::outlier_detection::{modified_zscores, OUTLIER_THRESHOLD};
use hyperfine::timer::{TimerStart, TimerStop};
use hyperfine::timer::wallclocktimer::WallClockTimer;
use hyperfine::shell::execute_and_time;
use hyperfine::types::{BenchmarkResult, Command};
/// Results from timing a single shell command
#[derive(Debug, Default, Copy, Clone)]
+1 -1
View File
@@ -1,6 +1,6 @@
use std::num;
use std::error::Error;
use std::fmt;
use std::num;
#[derive(Debug)]
pub enum ParameterScanError {
+1 -1
View File
@@ -6,8 +6,8 @@ use self::csv::CsvExporter;
use self::json::JsonExporter;
use self::markdown::MarkdownExporter;
use std::io::{Result, Write};
use std::fs::File;
use std::io::{Result, Write};
use hyperfine::types::BenchmarkResult;
+4 -2
View File
@@ -31,14 +31,16 @@ pub fn get_progress_bar(length: u64, msg: &str, option: &OutputStyleOption) -> P
/// A max function for f64's without NaNs
pub fn max(vals: &[f64]) -> f64 {
*vals.iter()
*vals
.iter()
.max_by(|a, b| a.partial_cmp(b).unwrap())
.unwrap()
}
/// A min function for f64's without NaNs
pub fn min(vals: &[f64]) -> f64 {
*vals.iter()
*vals
.iter()
.min_by(|a, b| a.partial_cmp(b).unwrap())
.unwrap()
}
+2 -2
View File
@@ -1,4 +1,6 @@
pub mod app;
pub mod benchmark;
pub mod error;
pub mod export;
pub mod format;
pub mod internal;
@@ -7,5 +9,3 @@ pub mod shell;
pub mod timer;
pub mod types;
pub mod warnings;
pub mod error;
pub mod app;
-1
View File
@@ -4,7 +4,6 @@
/// - Boris Iglewicz and David Hoaglin (1993), "Volume 16: How to Detect and Handle Outliers",
/// The ASQC Basic References in Quality Control: Statistical Techniques, Edward F. Mykytka,
/// Ph.D., Editor.
use statistical::median;
/// Minimum modified Z-score for a datapoint to be an outlier. Here, 1.4826 is a factor that
+10 -2
View File
@@ -50,7 +50,11 @@ pub fn execute_and_time(stdout: Stdio, stderr: Stdio, command: &str) -> io::Resu
/// Run a standard shell command
#[cfg(not(windows))]
fn run_shell_command(stdout: Stdio, stderr: Stdio, command: &str) -> io::Result<std::process::ExitStatus> {
fn run_shell_command(
stdout: Stdio,
stderr: Stdio,
command: &str,
) -> io::Result<std::process::ExitStatus> {
Command::new("sh")
.arg("-c")
.arg(command)
@@ -62,7 +66,11 @@ fn run_shell_command(stdout: Stdio, stderr: Stdio, command: &str) -> io::Result<
/// Run a Windows shell command using cmd.exe
#[cfg(windows)]
fn run_shell_command(stdout: Stdio, stderr: Stdio, command: &str) -> io::Result<std::process::Child> {
fn run_shell_command(
stdout: Stdio,
stderr: Stdio,
command: &str,
) -> io::Result<std::process::Child> {
Command::new("cmd")
.arg("/C")
.arg(command)
+1 -1
View File
@@ -1,8 +1,8 @@
use std::process::Child;
use std::time::Instant;
use hyperfine::types::Second;
use hyperfine::timer::{TimerStart, TimerStop};
use hyperfine::types::Second;
pub struct WallClockTimer {
start: Instant,
-1
View File
@@ -1,5 +1,4 @@
/// This module contains common internal types.
use std::fmt;
/// Type alias for unit of time
+1 -1
View File
@@ -1,8 +1,8 @@
use std::fmt;
use hyperfine::format::format_duration;
use hyperfine::internal::MIN_EXECUTION_TIME;
use hyperfine::types::Second;
use hyperfine::format::format_duration;
/// A list of all possible warnings
pub enum Warnings {
+10 -10
View File
@@ -29,24 +29,25 @@ cfg_if! {
extern crate approx;
use std::cmp;
use std::error::Error;
use std::env;
use std::error::Error;
use std::io;
use std::ops::Range;
use atty::Stream;
use colored::*;
use clap::ArgMatches;
use colored::*;
mod hyperfine;
use hyperfine::internal::write_benchmark_comparison;
use hyperfine::types::{BenchmarkResult, CmdFailureAction, Command, HyperfineOptions,
OutputStyleOption};
use hyperfine::benchmark::{mean_shell_spawning_time, run_benchmark};
use hyperfine::export::{ExportManager, ExportType};
use hyperfine::error::ParameterScanError;
use hyperfine::app::get_arg_matches;
use hyperfine::benchmark::{mean_shell_spawning_time, run_benchmark};
use hyperfine::error::ParameterScanError;
use hyperfine::export::{ExportManager, ExportType};
use hyperfine::internal::write_benchmark_comparison;
use hyperfine::types::{
BenchmarkResult, CmdFailureAction, Command, HyperfineOptions, OutputStyleOption,
};
/// Print error message to stderr and terminate
pub fn error(message: &str) -> ! {
@@ -56,8 +57,7 @@ pub fn error(message: &str) -> ! {
/// Runs the benchmark for the given commands
fn run(commands: &Vec<Command>, options: &HyperfineOptions) -> io::Result<Vec<BenchmarkResult>> {
let shell_spawning_time =
mean_shell_spawning_time(&options.output_style, options.show_output)?;
let shell_spawning_time = mean_shell_spawning_time(&options.output_style, options.show_output)?;
let mut timing_results = vec![];