Skip to content

Commit

Permalink
Merge pull request Rust-SDL2#940 from dmitmel/remove-rand
Browse files Browse the repository at this point in the history
Remove dependency on the rand crate
  • Loading branch information
Cobrand authored Nov 5, 2019
2 parents 133dfe8 + ad82b1b commit 1173834
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 15 deletions.
4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ path = "src/sdl2/lib.rs"
[dependencies]
bitflags = "^1"
libc = "^0.2"
rand = "^0.6"
lazy_static = "^1"

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

[dev-dependencies]
rand = "^0.7"

[features]

unsafe_textures = []
Expand Down
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ when upgrading from a version of rust-sdl2 to another.

### v0.32.3 (unreleased)

[PR #938](https://github.com/Rust-SDL2/rust-sdl2/pull/938)
**Breaking change** Removed the `rand` crate from dependencies.

[PR #907](https://github.com/Rust-SDL2/rust-sdl2/pull/907)
Changed the data type to i32 for the `which` field for the events `ControllerDeviceAdded` and `JoyDeviceAdded`.

Expand Down
14 changes: 0 additions & 14 deletions src/sdl2/pixels.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
extern crate rand;
use self::rand::Rng;
use self::rand::distributions::{Distribution, Standard};

use num::FromPrimitive;
use std::mem::transmute;
use std::convert::TryFrom;
Expand Down Expand Up @@ -171,16 +167,6 @@ impl From<(u8, u8, u8, u8)> for Color {
}
}

impl Distribution<Color> for Standard {
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Color {
if rng.gen() {
Color::RGBA(rng.gen(), rng.gen(), rng.gen(), rng.gen())
} else {
Color::RGB(rng.gen(), rng.gen(), rng.gen())
}
}
}

pub struct PixelMasks {
/// Bits per pixel; usually 15, 16, or 32
pub bpp: u8,
Expand Down

0 comments on commit 1173834

Please sign in to comment.