Skip to content

Commit 8ab3708

Browse files
committed
Fix comment
1 parent 6dd0db7 commit 8ab3708

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/os.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -357,9 +357,10 @@ mod imp {
357357
if dest.len() == 0 { return Ok(()); }
358358
trace!("OsRng: reading {} bytes from random device", dest.len());
359359

360-
// Since we have an instance of Self, we can assume that our memory was
361-
// set with a valid object.
362-
let mutex = unsafe{ READ_RNG_FILE.as_ref().unwrap() };
360+
// We expect this function only to be used after `open_dev_random` was
361+
// succesful. Therefore we can assume that our memory was set with a
362+
// valid object.
363+
let mutex = unsafe { READ_RNG_FILE.as_ref().unwrap() };
363364
let mut guard = mutex.lock().unwrap();
364365
let file = (*guard).as_mut().unwrap();
365366
// Use `std::io::read_exact`, which retries on `ErrorKind::Interrupted`.

0 commit comments

Comments
 (0)