about summary refs log tree commit diff
diff options
context:
space:
mode:
authorljedrz <ljedrz@gmail.com>2018-07-23 14:10:31 +0200
committerljedrz <ljedrz@gmail.com>2018-07-23 14:10:31 +0200
commitd89ac4caf7b49596c6258f9b8f7f8b4f9945fbc5 (patch)
treedc97699aa500da2246e7abb2da2846a714cf8e0b
parent210d61f05c8c2f9e58f167eb28ab9d8bbef4968b (diff)
downloadrust-d89ac4caf7b49596c6258f9b8f7f8b4f9945fbc5.tar.gz
rust-d89ac4caf7b49596c6258f9b8f7f8b4f9945fbc5.zip
Simplify 2 functions in rustc_mir/dataflow
-rw-r--r--src/librustc_mir/dataflow/graphviz.rs4
-rw-r--r--src/librustc_mir/dataflow/mod.rs11
2 files changed, 3 insertions, 12 deletions
diff --git a/src/librustc_mir/dataflow/graphviz.rs b/src/librustc_mir/dataflow/graphviz.rs
index 9096ac1444c..fd0c3f24907 100644
--- a/src/librustc_mir/dataflow/graphviz.rs
+++ b/src/librustc_mir/dataflow/graphviz.rs
@@ -73,8 +73,8 @@ pub type Node = BasicBlock;
 pub struct Edge { source: BasicBlock, index: usize }
 
 fn outgoing(mir: &Mir, bb: BasicBlock) -> Vec<Edge> {
-    mir[bb].terminator().successors().enumerate()
-        .map(|(index, _)| Edge { source: bb, index: index}).collect()
+    (0..mir[bb].terminator().successors().count())
+        .map(|index| Edge { source: bb, index: index}).collect()
 }
 
 impl<'a, 'tcx, MWF, P> dot::Labeller<'a> for Graph<'a, 'tcx, MWF, P>
diff --git a/src/librustc_mir/dataflow/mod.rs b/src/librustc_mir/dataflow/mod.rs
index f58609aa9a5..4227f0bcd36 100644
--- a/src/librustc_mir/dataflow/mod.rs
+++ b/src/librustc_mir/dataflow/mod.rs
@@ -441,11 +441,6 @@ pub struct DataflowState<O: BitDenotation>
 }
 
 impl<O: BitDenotation> DataflowState<O> {
-    pub fn each_bit<F>(&self, words: &IdxSet<O::Idx>, f: F) where F: FnMut(O::Idx)
-    {
-        words.iter().for_each(f)
-    }
-
     pub(crate) fn interpret_set<'c, P>(&self,
                                        o: &'c O,
                                        words: &IdxSet<O::Idx>,
@@ -453,11 +448,7 @@ impl<O: BitDenotation> DataflowState<O> {
                                        -> Vec<DebugFormatted>
         where P: Fn(&O, O::Idx) -> DebugFormatted
     {
-        let mut v = Vec::new();
-        self.each_bit(words, |i| {
-            v.push(render_idx(o, i));
-        });
-        v
+        words.iter().map(|i| render_idx(o, i)).collect()
     }
 }