Skip to content

Commit

Permalink
Review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dhardy committed Apr 3, 2019
1 parent b8d4fc3 commit d0feb11
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/rngs/os.rs
Expand Up @@ -25,7 +25,7 @@ pub struct OsRng;

impl OsRng {
/// Create a new `OsRng`.
#[deprecated(since="0.2.0", note="replace OsRng::new().unwrap() with just OsRng")]
#[deprecated(since="0.7.0", note="replace OsRng::new().unwrap() with just OsRng")]
pub fn new() -> Result<OsRng, Error> {
Ok(OsRng)
}
Expand All @@ -49,10 +49,6 @@ impl RngCore for OsRng {
}

fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error> {
// Some systems do not support reading 0 random bytes.
// (And why waste a system call?)
if dest.len() == 0 { return Ok(()); }

getrandom(dest).map_err(|e|
Error::with_cause(ErrorKind::Unavailable, "OsRng failed", e))
}
Expand Down

0 comments on commit d0feb11

Please sign in to comment.