diff --git a/src/libtest/stats.rs b/src/libtest/stats.rs index 2e4fb872d70..e73a43efe76 100644 --- a/src/libtest/stats.rs +++ b/src/libtest/stats.rs @@ -184,8 +184,7 @@ impl<'a,T: Float + FromPrimitive> Stats for &'a [T] { // `lo`. Together `hi+lo` are exactly equal to `x+y`. let hi = x + y; let lo = y - (hi - x); - let zero: T = Zero::zero(); - if lo != zero { + if !lo.is_zero() { *partials.get_mut(j) = lo; j += 1; } @@ -373,13 +372,13 @@ pub fn write_boxplot( // need to consider when the limit is zero let zero: T = Zero::zero(); - let lo = if lomag == zero { + let lo = if lomag.is_zero() { zero } else { (s.min / lomag).floor() * lomag }; - let hi = if himag == zero { + let hi = if himag.is_zero() { zero } else { (s.max / himag).ceil() * himag