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
Provenance
- Commit
1027940- Tree
a7638d0- Author
David Peter <mail@david-peter.de>- Committer
David Peter <sharkdp@users.noreply.github.com>- Parent
76dd9d4
5 files changed+36 added−38 removed
modified:src/benchmark.rs+4 added-1 removed
6 unmodified lines7 8 use crate::benchmark_result::BenchmarkResult;9 use crate::command::Command;10 use crate::format::{format_duration, format_duration_unit};11-use crate::internal::{max, min, MIN_EXECUTION_TIME};11+use crate::min_max::{max, min};12 use crate::options::{CmdFailureAction, HyperfineOptions, OutputStyleOption};13 use crate::outlier_detection::{modified_zscores, OUTLIER_THRESHOLD};14 use crate::progress_bar::get_progress_bar;15 use crate::shell::execute_and_time;1 unmodified line17 use crate::timer::{TimerStart, TimerStop};18 use crate::units::Second;19 use crate::warnings::Warnings;20 21+/// Threshold for warning about fast execution time22+pub const MIN_EXECUTION_TIME: Second = 5e-3;23+24 /// Results from timing a single shell command25 #[derive(Debug, Default, Copy, Clone)]26 pub struct TimingResult {27 /// Wall clock time461 unmodified linesdeleted:src/internal.rs-35 removed
1-use std::iter::Iterator;2-3-use crate::units::Second;4-5-/// Threshold for warning about fast execution time6-pub const MIN_EXECUTION_TIME: Second = 5e-3;7-8-/// A max function for f64's without NaNs9-pub fn max(vals: &[f64]) -> f64 {10- *vals11- .iter()12- .max_by(|a, b| a.partial_cmp(b).unwrap())13- .unwrap()14-}15-16-/// A min function for f64's without NaNs17-pub fn min(vals: &[f64]) -> f64 {18- *vals19- .iter()20- .min_by(|a, b| a.partial_cmp(b).unwrap())21- .unwrap()22-}23-24-#[test]25-fn test_max() {26- let assert_float_eq = |a: f64, b: f64| {27- assert!((a - b).abs() < f64::EPSILON);28- };29-30- 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 lines13 pub mod command;14 pub mod error;15 pub mod export;16 pub mod format;17-pub mod internal;17+pub mod min_max;18 pub mod options;19 pub mod outlier_detection;20 pub mod parameter_range;21 pub mod progress_bar;439 unmodified linesadded:src/min_max.rs+30 added
1+use std::iter::Iterator;2+3+/// A max function for f64's without NaNs4+pub fn max(vals: &[f64]) -> f64 {5+ *vals6+ .iter()7+ .max_by(|a, b| a.partial_cmp(b).unwrap())8+ .unwrap()9+}10+11+/// A min function for f64's without NaNs12+pub fn min(vals: &[f64]) -> f64 {13+ *vals14+ .iter()15+ .min_by(|a, b| a.partial_cmp(b).unwrap())16+ .unwrap()17+}18+19+#[test]20+fn test_max() {21+ let assert_float_eq = |a: f64, b: f64| {22+ assert!((a - b).abs() < f64::EPSILON);23+ };24+25+ 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
1 use std::fmt;2 3+use crate::benchmark::MIN_EXECUTION_TIME;4 use crate::format::format_duration;4-use crate::internal::MIN_EXECUTION_TIME;5 use crate::units::Second;6 7 /// A list of all possible warnings8 pub enum Warnings {33 unmodified lines