We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 54e7f9a commit 5523b59Copy full SHA for 5523b59
src/rng.rs
@@ -130,6 +130,10 @@ macro_rules! rng_core {
130
let mut i = 0_usize;
131
while i < buffer.len() {
132
let random_word = self.value()?;
133
+
134
+ // using to_ne_bytes does not work for u8 and would make the macro
135
+ // implementation more complicated
136
+ #[allow(clippy::transmute_num_to_bytes)]
137
let bytes: [$type; BATCH_SIZE] = unsafe { mem::transmute(random_word) };
138
let n = cmp::min(BATCH_SIZE, buffer.len() - i);
139
buffer[i..i + n].copy_from_slice(&bytes[..n]);
0 commit comments