Bump to 0.3.5
diff --git a/Cargo.toml b/Cargo.toml
index abe1449..33f88a2 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "rand"
-version = "0.3.4"
+version = "0.3.5"
authors = ["The Rust Project Developers"]
license = "MIT/Apache-2.0"
readme = "README.md"
diff --git a/src/distributions/range.rs b/src/distributions/range.rs
index a3a3c46..4eee786 100644
--- a/src/distributions/range.rs
+++ b/src/distributions/range.rs
@@ -88,7 +88,7 @@
}
macro_rules! integer_impl {
- ($ty:ty, $unsigned:ty) => {
+ ($ty:ty, $unsigned:ident) => {
impl SampleRange for $ty {
// we play free and fast with unsigned vs signed here
// (when $ty is signed), but that's fine, since the
@@ -98,7 +98,7 @@
fn construct_range(low: $ty, high: $ty) -> Range<$ty> {
let range = (w(high as $unsigned) - w(low as $unsigned)).0;
- let unsigned_max: $unsigned = -1 as $unsigned;
+ let unsigned_max: $unsigned = ::std::$unsigned::MAX;
// this is the largest number that fits into $unsigned
// that `range` divides evenly, so, if we've sampled
@@ -163,7 +163,6 @@
#[cfg(test)]
mod tests {
- use std::num::Int;
use distributions::{Sample, IndependentSample};
use super::Range as Range;
@@ -182,11 +181,11 @@
fn test_integers() {
let mut rng = ::test::rng();
macro_rules! t {
- ($($ty:ty),*) => {{
+ ($($ty:ident),*) => {{
$(
let v: &[($ty, $ty)] = &[(0, 10),
(10, 127),
- (Int::min_value(), Int::max_value())];
+ (::std::$ty::MIN, ::std::$ty::MAX)];
for &(low, high) in v.iter() {
let mut sampler: Range<$ty> = Range::new(low, high);
for _ in 0..1000 {
diff --git a/src/rand_impls.rs b/src/rand_impls.rs
index d594ee2..0303a9c 100644
--- a/src/rand_impls.rs
+++ b/src/rand_impls.rs
@@ -11,15 +11,14 @@
//! The implementations of `Rand` for the built-in types.
use std::char;
-use std::isize;
-use std::usize;
+use std::mem;
use {Rand,Rng};
impl Rand for isize {
#[inline]
fn rand<R: Rng>(rng: &mut R) -> isize {
- if isize::BITS == 32 {
+ if mem::size_of::<isize>() == 4 {
rng.gen::<i32>() as isize
} else {
rng.gen::<i64>() as isize
@@ -58,7 +57,7 @@
impl Rand for usize {
#[inline]
fn rand<R: Rng>(rng: &mut R) -> usize {
- if usize::BITS == 32 {
+ if mem::size_of::<usize>() == 4 {
rng.gen::<u32>() as usize
} else {
rng.gen::<u64>() as usize
diff --git a/src/read.rs b/src/read.rs
index f8547fb..efa9d60 100644
--- a/src/read.rs
+++ b/src/read.rs
@@ -78,7 +78,6 @@
#[cfg(test)]
mod test {
use super::ReadRng;
- use std::num::Int;
use Rng;
#[test]