Skip to content

Commit 79a832b

Browse files
authored
Merge pull request #940 from dmitmel/remove-rand
Remove dependency on the rand crate
2 parents ddaf024 + 0a052cd commit 79a832b

File tree

3 files changed

+6
-15
lines changed

3 files changed

+6
-15
lines changed

Cargo.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ path = "src/sdl2/lib.rs"
1818
[dependencies]
1919
bitflags = "^1"
2020
libc = "^0.2"
21-
rand = "^0.6"
2221
lazy_static = "^1"
2322

2423
[dependencies.num]
@@ -33,6 +32,9 @@ version = "^0.32"
3332
version = ">= 1.0, <= 1.3"
3433
optional = true
3534

35+
[dev-dependencies]
36+
rand = "^0.7"
37+
3638
[features]
3739

3840
unsafe_textures = []

changelog.md

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ when upgrading from a version of rust-sdl2 to another.
33

44
### v0.32.3 (unreleased)
55

6+
[PR #938](https://github.com/Rust-SDL2/rust-sdl2/pull/938)
7+
**Breaking change** Removed the `rand` crate from dependencies.
8+
69
[PR #907](https://github.com/Rust-SDL2/rust-sdl2/pull/907)
710
Changed the data type to i32 for the `which` field for the events `ControllerDeviceAdded` and `JoyDeviceAdded`.
811

src/sdl2/pixels.rs

-14
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
extern crate rand;
2-
use self::rand::Rng;
3-
use self::rand::distributions::{Distribution, Standard};
4-
51
use num::FromPrimitive;
62
use std::mem::transmute;
73
use std::convert::TryFrom;
@@ -171,16 +167,6 @@ impl From<(u8, u8, u8, u8)> for Color {
171167
}
172168
}
173169

174-
impl Distribution<Color> for Standard {
175-
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Color {
176-
if rng.gen() {
177-
Color::RGBA(rng.gen(), rng.gen(), rng.gen(), rng.gen())
178-
} else {
179-
Color::RGB(rng.gen(), rng.gen(), rng.gen())
180-
}
181-
}
182-
}
183-
184170
pub struct PixelMasks {
185171
/// Bits per pixel; usually 15, 16, or 32
186172
pub bpp: u8,

0 commit comments

Comments
 (0)