Skip to content

Commit ca10d56

Browse files
committed
f sp and condense possiblyrandom
1 parent 5f585f6 commit ca10d56

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

possiblyrandom/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ authors = ["Matt Corallo"]
55
license = "MIT OR Apache-2.0"
66
repository = "https://github.com/lightningdevkit/rust-lightning/"
77
description = """
8-
A crate which wraps getrandom and always compiles, returning 0s when no randomness is available.
8+
A crate that wraps getrandom and always compiles, returning 0s when no randomness is available.
99
"""
1010
edition = "2021"
1111

possiblyrandom/src/lib.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// You may not use this file except in accordance with one or both of these
88
// licenses.
99

10-
//! [`getrandom`] provides access to OS randomness, but will fail to compile on platforms which do
10+
//! [`getrandom`] provides access to OS randomness, but will fail to compile on platforms that do
1111
//! not support fetching OS randomness. This is exactly what you want when you're doing
1212
//! cryptographic operations, but when you're just opportunistically randomizing, we're fine with
1313
//! compiling and simply disabling randomization.
@@ -24,17 +24,12 @@
2424
extern crate getrandom;
2525

2626
/// Possibly fills `dest` with random data. May fill it with zeros.
27-
#[cfg(feature = "getrandom")]
2827
#[inline]
2928
pub fn getpossiblyrandom(dest: &mut [u8]) {
29+
#[cfg(feature = "getrandom")]
3030
if getrandom::getrandom(dest).is_err() {
3131
dest.fill(0);
3232
}
33-
}
34-
35-
/// Possibly fills `dest` with random data. May fill it with zeros.
36-
#[cfg(not(feature = "getrandom"))]
37-
#[inline]
38-
pub fn getpossiblyrandom(dest: &mut [u8]) {
33+
#[cfg(not(feature = "getrandom"))]
3934
dest.fill(0);
4035
}

0 commit comments

Comments
 (0)