From 959fed1d8435070e39bd7b87c1e908f79b65add9 Mon Sep 17 00:00:00 2001 From: Corey Richardson Date: Sun, 24 Sep 2017 08:34:58 -0400 Subject: Fix compiler warnings Some minor stuff, mostly. The features have been stable since 1.20 --- src/synth/noise.rs | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'src/synth/noise.rs') diff --git a/src/synth/noise.rs b/src/synth/noise.rs index 68c120f..28a6b60 100644 --- a/src/synth/noise.rs +++ b/src/synth/noise.rs @@ -2,7 +2,6 @@ use std::mem; use super::*; use ::rand::{XorShiftRng, Rng, SeedableRng}; -use ::rand::os::OsRng; #[derive(Debug)] pub struct Noise { @@ -11,7 +10,7 @@ pub struct Noise { } impl Generator for Noise { - fn eval<'a>(&'a mut self, params: &Parameters) -> &'a SampleBuffer { + fn eval<'a>(&'a mut self, _params: &Parameters) -> &'a SampleBuffer { self.buf.rate = Rate::Sample; for i in 0..self.buf.len() { @@ -26,23 +25,17 @@ impl Generator for Noise { } } -static mut _rand_gen: Option = None; - pub struct NoiseFactory; impl GeneratorFactory for NoiseFactory { fn new(&self, params: &mut FactoryParameters) -> Result { - if unsafe { &_rand_gen }.is_none() { - unsafe {_rand_gen = Some(OsRng::new().expect("Couldn't initialize OS random")); } - } - - let mut seed: [u32; 4] = Default::default(); + let mut seed: [u32; 4] = ::rand::random(); for i in seed.iter_mut() { - *i = unsafe { &mut _rand_gen }.as_mut().unwrap().next_u32(); + *i = ::rand::random() } Ok(Box::new(Noise { - rng: XorShiftRng::from_seed(seed), + rng: XorShiftRng::from_seed(::rand::random()), buf: SampleBuffer::new(params.env.default_buffer_size), })) } -- cgit v1.2.3-70-g09d2