Skip to content

Commit

Permalink
Fix is_zero()/num::zero() deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Jorge Aparicio committed Nov 14, 2014
1 parent da88152 commit 63bd8a6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/arbitrary.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::collections::TrieMap;
use std::mem;
use std::num::{Primitive, SignedInt, UnsignedInt, mod};
use std::num::{Int, Primitive, SignedInt, UnsignedInt, mod};
use std::rand::Rng;

/// `Gen` wraps a `rand::Rng` with parameters to control the distribution of
Expand Down Expand Up @@ -418,18 +418,18 @@ struct SignedShrinker<A> {

impl<A: Primitive + SignedInt + Send> SignedShrinker<A> {
fn new(x: A) -> Box<Shrinker<A>+'static> {
if x.is_zero() {
if x == Int::zero() {
empty_shrinker()
} else {
let shrinker = SignedShrinker {
x: x,
i: half(x),
};
if shrinker.i.is_negative() {
box vec![num::zero(), shrinker.x.abs()]
box vec![Int::zero(), shrinker.x.abs()]
.into_iter().chain(shrinker)
} else {
box vec![num::zero()].into_iter().chain(shrinker)
box vec![Int::zero()].into_iter().chain(shrinker)
}
}
}
Expand All @@ -454,10 +454,10 @@ struct UnsignedShrinker<A> {

impl<A: Primitive + UnsignedInt + Send> UnsignedShrinker<A> {
fn new(x: A) -> Box<Shrinker<A>+'static> {
if x.is_zero() {
if x == Int::zero() {
empty_shrinker::<A>()
} else {
box vec![num::zero()].into_iter().chain(
box vec![Int::zero()].into_iter().chain(
UnsignedShrinker {
x: x,
i: half(x),
Expand Down

0 comments on commit 63bd8a6

Please sign in to comment.