use a with_capacity while allocating the progress view

This commit is contained in:
Tamo 2024-12-11 18:17:33 +01:00
parent ab9213fa94
commit 75d5cea624
No known key found for this signature in database
GPG Key ID: 20CD8020AFA88D69

View File

@ -37,7 +37,7 @@ impl Progress {
let mut percentage = 0.0; let mut percentage = 0.0;
let mut prev_factors = 1.0; let mut prev_factors = 1.0;
let mut step_view = Vec::new(); let mut step_view = Vec::with_capacity(steps.len());
for (_, step) in steps.iter() { for (_, step) in steps.iter() {
prev_factors *= step.total() as f32; prev_factors *= step.total() as f32;
percentage += step.current() as f32 / prev_factors; percentage += step.current() as f32 / prev_factors;