[thin_check (rust)] Use vec::with_capacity() to avoid reallocations.

This commit is contained in:
Joe Thornber
2020-08-21 09:00:21 +01:00
parent 2cc2dffab5
commit c9a759b4e8
4 changed files with 5 additions and 5 deletions

View File

@@ -172,7 +172,7 @@ fn check_space_map(
w.walk(&mut v, root.ref_count_root)?;
}
let mut blocks = Vec::new();
let mut blocks = Vec::with_capacity(entries.len());
for i in &entries {
blocks.push(Block::new(i.blocknr));
}
@@ -243,7 +243,7 @@ fn repair_space_map(ctx: &Context, entries: Vec<BitmapLeak>, sm: ASpaceMap) -> R
let sm = sm.lock().unwrap();
let mut blocks = Vec::new();
let mut blocks = Vec::with_capacity(entries.len());
for i in &entries {
blocks.push(Block::new(i.loc));
}