Skip to content
Myr

Completely remove internal.rs

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Peter · committed by David Peter · parent 76dd9d4 · Browse files · 5 files+36 added−38 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

5 files+36 added−38 removed

  • other:+36 added−38 removed

5 files+36 added−38 removed

modified:src/benchmark.rs+4 added-1 removed
6 unmodified lines
78use crate::benchmark_result::BenchmarkResult;9use crate::command::Command;10use crate::format::{format_duration, format_duration_unit};11use crate::internal::{max, min, MIN_EXECUTION_TIME};11use crate::min_max::{max, min};12use crate::options::{CmdFailureAction, HyperfineOptions, OutputStyleOption};13use crate::outlier_detection::{modified_zscores, OUTLIER_THRESHOLD};14use crate::progress_bar::get_progress_bar;15use crate::shell::execute_and_time;
1 unmodified line
17use crate::timer::{TimerStart, TimerStop};18use crate::units::Second;19use crate::warnings::Warnings;2021/// Threshold for warning about fast execution time22pub const MIN_EXECUTION_TIME: Second = 5e-3;2324/// Results from timing a single shell command25#[derive(Debug, Default, Copy, Clone)]26pub struct TimingResult {27 /// Wall clock time
461 unmodified lines
deleted:src/internal.rs-35 removed
1use std::iter::Iterator;23use crate::units::Second;45/// Threshold for warning about fast execution time6pub const MIN_EXECUTION_TIME: Second = 5e-3;78/// A max function for f64's without NaNs9pub fn max(vals: &[f64]) -> f64 {10 *vals11 .iter()12 .max_by(|a, b| a.partial_cmp(b).unwrap())13 .unwrap()14}1516/// A min function for f64's without NaNs17pub fn min(vals: &[f64]) -> f64 {18 *vals19 .iter()20 .min_by(|a, b| a.partial_cmp(b).unwrap())21 .unwrap()22}2324#[test]25fn test_max() {26 let assert_float_eq = |a: f64, b: f64| {27 assert!((a - b).abs() < f64::EPSILON);28 };2930 assert_float_eq(1.0, max(&[1.0]));31 assert_float_eq(-1.0, max(&[-1.0]));32 assert_float_eq(-1.0, max(&[-2.0, -1.0]));33 assert_float_eq(1.0, max(&[-1.0, 1.0]));34 assert_float_eq(1.0, max(&[-1.0, 1.0, 0.0]));35}
modified:src/main.rs+1 added-1 removed
12 unmodified lines
13pub mod command;14pub mod error;15pub mod export;16pub mod format;17pub mod internal;17pub mod min_max;18pub mod options;19pub mod outlier_detection;20pub mod parameter_range;21pub mod progress_bar;
439 unmodified lines
added:src/min_max.rs+30 added
1use std::iter::Iterator;23/// A max function for f64's without NaNs4pub fn max(vals: &[f64]) -> f64 {5 *vals6 .iter()7 .max_by(|a, b| a.partial_cmp(b).unwrap())8 .unwrap()9}1011/// A min function for f64's without NaNs12pub fn min(vals: &[f64]) -> f64 {13 *vals14 .iter()15 .min_by(|a, b| a.partial_cmp(b).unwrap())16 .unwrap()17}1819#[test]20fn test_max() {21 let assert_float_eq = |a: f64, b: f64| {22 assert!((a - b).abs() < f64::EPSILON);23 };2425 assert_float_eq(1.0, max(&[1.0]));26 assert_float_eq(-1.0, max(&[-1.0]));27 assert_float_eq(-1.0, max(&[-2.0, -1.0]));28 assert_float_eq(1.0, max(&[-1.0, 1.0]));29 assert_float_eq(1.0, max(&[-1.0, 1.0, 0.0]));30}
modified:src/warnings.rs+1 added-1 removed
1use std::fmt;23use crate::benchmark::MIN_EXECUTION_TIME;4use crate::format::format_duration;4use crate::internal::MIN_EXECUTION_TIME;5use crate::units::Second;67/// A list of all possible warnings8pub enum Warnings {
33 unmodified lines