Use vec![0; size] instead of creating an empty Vec and resizing.

This commit is contained in:
Dan Gohman
2019-01-03 14:08:31 -08:00
parent a41bc1fe1e
commit 585bdac91e
2 changed files with 5 additions and 14 deletions

View File

@@ -25,18 +25,10 @@ impl Table {
};
match plan.style {
TableStyle::CallerChecksSignature => {
let mut vec = Vec::with_capacity(plan.table.minimum as usize);
vec.resize(
plan.table.minimum as usize,
VMCallerCheckedAnyfunc::default(),
);
Self {
vec,
maximum: plan.table.maximum,
}
}
TableStyle::CallerChecksSignature => Self {
vec: vec![VMCallerCheckedAnyfunc::default(); plan.table.minimum as usize],
maximum: plan.table.maximum,
},
}
}