Fix clippy errors

This commit is contained in:
David Peter authored and David Peter committed 2021-07-27 09:26:49 +02:00
1 parent 1aefe14d67
commit de59bb5ff1
2 files changed
+11 -7

No files matched your search

+9 -5
View File
@@ -136,11 +136,15 @@ pub fn write_benchmark_comparison(results: &[BenchmarkResult]) {
#[test]
fn test_max() {
assert_eq!(1.0, max(&[1.0]));
assert_eq!(-1.0, max(&[-1.0]));
assert_eq!(-1.0, max(&[-2.0, -1.0]));
assert_eq!(1.0, max(&[-1.0, 1.0]));
assert_eq!(1.0, max(&[-1.0, 1.0, 0.0]));
let assert_float_eq = |a, b| {
assert!((a - b) < f64::EPSILON);
};
assert_float_eq(1.0, max(&[1.0]));
assert_float_eq(-1.0, max(&[-1.0]));
assert_float_eq(-1.0, max(&[-2.0, -1.0]));
assert_float_eq(1.0, max(&[-1.0, 1.0]));
assert_float_eq(1.0, max(&[-1.0, 1.0, 0.0]));
}
#[cfg(test)]
+2 -2
View File
@@ -82,8 +82,8 @@ fn test_cpu_time_interval() {
};
let t_zero = cpu_time_interval(&t_a, &t_a);
assert_eq!(0.0, t_zero.user);
assert_eq!(0.0, t_zero.system);
assert!(t_zero.user.abs() < f64::EPSILON);
assert!(t_zero.system.abs() < f64::EPSILON);
let t_ab = cpu_time_interval(&t_a, &t_b);
assert_relative_eq!(0.007655, t_ab.user);