mirror of
https://github.com/ouch-org/ouch.git
synced 2025-06-06 11:35:45 +00:00
Fix clippy performance lint
See https://rust-lang.github.io/rust-clippy/master/index.html#slow_vector_initialization
This commit is contained in:
parent
63ad6b419c
commit
f847040e69
@ -51,8 +51,7 @@ pub fn create_files_in(dir: &Path, files: &[&str]) {
|
|||||||
|
|
||||||
// write random content to a file
|
// write random content to a file
|
||||||
pub fn write_random_content(file: &mut impl Write, rng: &mut impl RngCore) {
|
pub fn write_random_content(file: &mut impl Write, rng: &mut impl RngCore) {
|
||||||
let mut data = Vec::new();
|
let mut data = vec![0; rng.gen_range(0..4096)];
|
||||||
data.resize(rng.gen_range(0..4096), 0);
|
|
||||||
rng.fill_bytes(&mut data);
|
rng.fill_bytes(&mut data);
|
||||||
file.write_all(&data).unwrap();
|
file.write_all(&data).unwrap();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user