about summary refs log tree commit diff
path: root/src/librustc_data_structures
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2018-08-13 19:05:07 -0400
committerNiko Matsakis <niko@alum.mit.edu>2018-08-27 13:57:55 -0400
commit1ab08ef846de872bb054520185dd07b79a2ee627 (patch)
tree8d6e5e93b727249e496107127fcb843162f2bbba /src/librustc_data_structures
parent57f39ee79bf11a563277ed8b700ceda0b8ee1390 (diff)
downloadrust-1ab08ef846de872bb054520185dd07b79a2ee627.tar.gz
rust-1ab08ef846de872bb054520185dd07b79a2ee627.zip
micro-optimize dominator code
Diffstat (limited to 'src/librustc_data_structures')
-rw-r--r--src/librustc_data_structures/graph/dominators/mod.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/librustc_data_structures/graph/dominators/mod.rs b/src/librustc_data_structures/graph/dominators/mod.rs
index e54147cbe7c..9b7f4cec47b 100644
--- a/src/librustc_data_structures/graph/dominators/mod.rs
+++ b/src/librustc_data_structures/graph/dominators/mod.rs
@@ -38,13 +38,13 @@ pub fn dominators_given_rpo<G: ControlFlowGraph>(
 
     // compute the post order index (rank) for each node
     let mut post_order_rank: IndexVec<G::Node, usize> =
-        IndexVec::from_elem_n(usize::default(), graph.num_nodes());
+        (0..graph.num_nodes()).map(|_| 0).collect();
     for (index, node) in rpo.iter().rev().cloned().enumerate() {
         post_order_rank[node] = index;
     }
 
     let mut immediate_dominators: IndexVec<G::Node, Option<G::Node>> =
-        IndexVec::from_elem_n(Option::default(), graph.num_nodes());
+        (0..graph.num_nodes()).map(|_| None).collect();
     immediate_dominators[start_node] = Some(start_node);
 
     let mut changed = true;