From 0e8e7d68a60e43ceaf3aa7b35bdb2317b51f3b07 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Mon, 2 Dec 2019 14:37:00 -0500 Subject: [PATCH] Drop a needless Vec --- src/datastore.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/datastore.rs b/src/datastore.rs index 354a37d..840863a 100644 --- a/src/datastore.rs +++ b/src/datastore.rs @@ -170,12 +170,12 @@ impl SockAddr { } struct Nodes { - good_node_services: Vec>, + good_node_services: [HashSet; 64], nodes_to_state: HashMap, state_next_scan: Vec>, } struct NodesMutRef<'a> { - good_node_services: &'a mut Vec>, + good_node_services: &'a mut [HashSet; 64], nodes_to_state: &'a mut HashMap, state_next_scan: &'a mut Vec>, } @@ -264,10 +264,7 @@ impl Store { for _ in 0..AddressState::get_count() { state_vecs.push(Vec::new()); } - let mut good_node_services = Vec::with_capacity(64); - for _ in 0..64 { - good_node_services.push(HashSet::new()); - } + let good_node_services = [HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new(), HashSet::new()]; Nodes { good_node_services, nodes_to_state: HashMap::new(), -- 2.30.2