From fbea2afe36872acfbaebf6f8e93013d08ae8b7d1 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 5 Nov 2019 22:57:26 +0200 Subject: [PATCH 1/2] Remove dependency on the rand crate --- Cargo.toml | 4 +++- src/sdl2/pixels.rs | 14 -------------- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 4814dff84bc..87171860754 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,7 +18,6 @@ path = "src/sdl2/lib.rs" [dependencies] bitflags = "^1" libc = "^0.2" -rand = "^0.6" lazy_static = "^1" [dependencies.num] @@ -33,6 +32,9 @@ version = "^0.32" version = ">= 1.0, <= 1.3" optional = true +[dev-dependencies] +rand = "^0.7" + [features] unsafe_textures = [] diff --git a/src/sdl2/pixels.rs b/src/sdl2/pixels.rs index c2d1d56d6c2..1b123511793 100644 --- a/src/sdl2/pixels.rs +++ b/src/sdl2/pixels.rs @@ -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; @@ -171,16 +167,6 @@ impl From<(u8, u8, u8, u8)> for Color { } } -impl Distribution for Standard { - fn sample(&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, From ad82b1bbc3c919086af64af712f82e746b26ec73 Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Tue, 5 Nov 2019 23:04:01 +0200 Subject: [PATCH 2/2] Update changelog --- changelog.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/changelog.md b/changelog.md index 054fa41c178..0c1245c201a 100644 --- a/changelog.md +++ b/changelog.md @@ -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`.