From: Matt Corallo Date: Mon, 2 Dec 2019 19:37:00 +0000 (-0500) Subject: Drop a needless Vec X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=dnsseed-rust;a=commitdiff_plain;h=0e8e7d68a60e43ceaf3aa7b35bdb2317b51f3b07 Drop a needless Vec --- 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(),