Skip to content

Commit 284d498

Browse files
committed
Bump to 0.3.5
1 parent ebec3dd commit 284d498

File tree

4 files changed

+8
-11
lines changed

4 files changed

+8
-11
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22

33
name = "rand"
4-
version = "0.3.4"
4+
version = "0.3.5"
55
authors = ["The Rust Project Developers"]
66
license = "MIT/Apache-2.0"
77
readme = "README.md"

src/distributions/range.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ pub trait SampleRange {
8888
}
8989

9090
macro_rules! integer_impl {
91-
($ty:ty, $unsigned:ty) => {
91+
($ty:ty, $unsigned:ident) => {
9292
impl SampleRange for $ty {
9393
// we play free and fast with unsigned vs signed here
9494
// (when $ty is signed), but that's fine, since the
@@ -98,7 +98,7 @@ macro_rules! integer_impl {
9898

9999
fn construct_range(low: $ty, high: $ty) -> Range<$ty> {
100100
let range = (w(high as $unsigned) - w(low as $unsigned)).0;
101-
let unsigned_max: $unsigned = -1 as $unsigned;
101+
let unsigned_max: $unsigned = ::std::$unsigned::MAX;
102102

103103
// this is the largest number that fits into $unsigned
104104
// that `range` divides evenly, so, if we've sampled
@@ -163,7 +163,6 @@ float_impl! { f64 }
163163

164164
#[cfg(test)]
165165
mod tests {
166-
use std::num::Int;
167166
use distributions::{Sample, IndependentSample};
168167
use super::Range as Range;
169168

@@ -182,11 +181,11 @@ mod tests {
182181
fn test_integers() {
183182
let mut rng = ::test::rng();
184183
macro_rules! t {
185-
($($ty:ty),*) => {{
184+
($($ty:ident),*) => {{
186185
$(
187186
let v: &[($ty, $ty)] = &[(0, 10),
188187
(10, 127),
189-
(Int::min_value(), Int::max_value())];
188+
(::std::$ty::MIN, ::std::$ty::MAX)];
190189
for &(low, high) in v.iter() {
191190
let mut sampler: Range<$ty> = Range::new(low, high);
192191
for _ in 0..1000 {

src/rand_impls.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,14 @@
1111
//! The implementations of `Rand` for the built-in types.
1212
1313
use std::char;
14-
use std::isize;
15-
use std::usize;
14+
use std::mem;
1615

1716
use {Rand,Rng};
1817

1918
impl Rand for isize {
2019
#[inline]
2120
fn rand<R: Rng>(rng: &mut R) -> isize {
22-
if isize::BITS == 32 {
21+
if mem::size_of::<isize>() == 4 {
2322
rng.gen::<i32>() as isize
2423
} else {
2524
rng.gen::<i64>() as isize
@@ -58,7 +57,7 @@ impl Rand for i64 {
5857
impl Rand for usize {
5958
#[inline]
6059
fn rand<R: Rng>(rng: &mut R) -> usize {
61-
if usize::BITS == 32 {
60+
if mem::size_of::<usize>() == 4 {
6261
rng.gen::<u32>() as usize
6362
} else {
6463
rng.gen::<u64>() as usize

src/read.rs

-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ fn fill(r: &mut Read, mut buf: &mut [u8]) -> io::Result<()> {
7878
#[cfg(test)]
7979
mod test {
8080
use super::ReadRng;
81-
use std::num::Int;
8281
use Rng;
8382

8483
#[test]

0 commit comments

Comments
 (0)