diff --git a/src/lib.rs b/src/lib.rs index f516211d7b..8d46271ab4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -272,7 +272,7 @@ extern crate stdweb; use core::{marker, mem, slice}; -#[cfg(all(feature="alloc", not(feature="std")))] use alloc::boxed::Box; +use core::ops::DerefMut; // external rngs pub use jitter::JitterRng; @@ -740,30 +740,7 @@ pub trait Rng: RngCore { impl Rng for R {} -impl<'a, R: RngCore + ?Sized> RngCore for &'a mut R { - #[inline] - fn next_u32(&mut self) -> u32 { - (**self).next_u32() - } - - #[inline] - fn next_u64(&mut self) -> u64 { - (**self).next_u64() - } - - #[inline] - fn fill_bytes(&mut self, dest: &mut [u8]) { - (**self).fill_bytes(dest) - } - - #[inline] - fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> { - (**self).try_fill_bytes(dest) - } -} - -#[cfg(any(feature="std", feature="alloc"))] -impl RngCore for Box { +impl> RngCore for T { #[inline] fn next_u32(&mut self) -> u32 { (**self).next_u32()