Skip to content

Commit

Permalink
Create the vec using with_capacity as we have the size.
Browse files Browse the repository at this point in the history
  • Loading branch information
ian-hamlin committed Apr 28, 2019
1 parent 80ebb2a commit b3a62df
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ fn next_chunk<T>(chunk_size: usize, reader: &mut csv::Reader<T>) -> Option<Vec<c
where
T: std::io::Read,
{
let mut chunks = Vec::new();
let mut chunks = Vec::with_capacity(chunk_size);

for (total, result) in reader.records().enumerate() {
match result {
Expand Down

0 comments on commit b3a62df

Please sign in to comment.