Allocating with capacity
This commit is contained in:
parent
217ce94e1c
commit
21584f4edf
3 changed files with 7 additions and 6 deletions
|
|
@ -47,7 +47,7 @@ impl DashboardViewState {
|
|||
}
|
||||
|
||||
pub fn from_unified_data(data: UnifiedData) -> Self {
|
||||
let mut groups = Vec::new();
|
||||
let mut groups = Vec::with_capacity(data.groups.len());
|
||||
|
||||
for group in data.groups {
|
||||
groups.push(GroupViewState {
|
||||
|
|
@ -92,7 +92,7 @@ fn get_status_history(heartbeats: &[HeartbeatEntry]) -> Vec<MonitorStatus> {
|
|||
}
|
||||
|
||||
fn add_monitor_view_state(group: UnifiedGroupData) -> Vec<MonitorViewState> {
|
||||
let mut monitors = Vec::new();
|
||||
let mut monitors = Vec::with_capacity(group.monitors.len());
|
||||
|
||||
for monitor in group.monitors {
|
||||
let status_history = get_status_history(&monitor.heartbeats);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue