Example in https://github.com/Gymmasssorla/finshir/blob/eae5d0c6761f5558c8ed33ef098d8bd13a07e64f/src/testing/helpers.rs#L55-L61
When pushing the same item to vec.
fn gen_portions() -> Vec<Vec<u8>> {
let mut spaces = Vec::with_capacity(EMPTY_SPACES_COUNT);
for _ in 0..EMPTY_SPACES_COUNT {
spaces.push(vec![b' ']);
}
spaces
}
Could be.
fn gen_portions() -> Vec<Vec<u8>> {
let mut spaces = Vec::with_capacity(EMPTY_SPACES_COUNT);
spaces.resize(EMPTY_SPACES_COUNT, vec![b' ']);
spaces
}
Maybe we could even use vec![b''].repeat(EMPTY_SPACES_COUNT) after stabilization ofrepeat_generic_size? rust-lang/rust#48784
Example in https://github.com/Gymmasssorla/finshir/blob/eae5d0c6761f5558c8ed33ef098d8bd13a07e64f/src/testing/helpers.rs#L55-L61
When pushing the same item to vec.
Could be.
Maybe we could even use
vec![b''].repeat(EMPTY_SPACES_COUNT)after stabilization ofrepeat_generic_size? rust-lang/rust#48784