-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
A-lintArea: New lintsArea: New lintsL-complexityLint: Belongs in the complexity lint groupLint: Belongs in the complexity lint groupgood first issueThese issues are a good way to get started with ClippyThese issues are a good way to get started with Clippy
Description
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
Metadata
Metadata
Assignees
Labels
A-lintArea: New lintsArea: New lintsL-complexityLint: Belongs in the complexity lint groupLint: Belongs in the complexity lint groupgood first issueThese issues are a good way to get started with ClippyThese issues are a good way to get started with Clippy