From a8da4f7309f1684d7c229de494c2527b6089b314 Mon Sep 17 00:00:00 2001 From: Dirk Leifeld Date: Fri, 2 May 2014 18:28:46 +0200 Subject: [PATCH] Use is_zero --- src/libtest/stats.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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