diff --git a/src/arbitrary.rs b/src/arbitrary.rs index 92f893b..9d972fc 100644 --- a/src/arbitrary.rs +++ b/src/arbitrary.rs @@ -824,9 +824,7 @@ macro_rules! signed_shrinker { impl Iterator for SignedShrinker { type Item = $ty; fn next(&mut self) -> Option<$ty> { - if self.x == <$ty>::MIN - || (self.x - self.i).abs() < self.x.abs() - { + if self.i != 0 { let result = Some(self.x - self.i); self.i = self.i / 2; result @@ -896,7 +894,8 @@ macro_rules! float_arbitrary { fn shrink(&self) -> Box> { signed_shrinker!($shrinkable); let it = shrinker::SignedShrinker::new(*self as $shrinkable); - Box::new(it.map(|x| x as $t)) + let old = *self; + Box::new(it.map(|x| x as $t).filter(move |x| *x != old)) } } )*};