mirror of
https://github.com/n0-computer/noq.git
synced 2026-09-25 04:35:17 +00:00
Fix unsound Vec::set_len in test
This commit is contained in:
committed by
Dirkjan Ochtman
parent
28129109cf
commit
39d3dadb60
@@ -179,8 +179,7 @@ fn hash_correct(data: &[u8], crc: &Crc<u32>) -> bool {
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
fn random_vec(size: usize) -> Vec<u8> {
|
||||
let mut ret = Vec::with_capacity(size);
|
||||
unsafe { ret.set_len(size) };
|
||||
let mut ret = vec![0; size];
|
||||
rand::thread_rng().fill_bytes(&mut ret[..]);
|
||||
ret
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user