Skip to content

Commit d89ac4c

Browse files
committed
Simplify 2 functions in rustc_mir/dataflow
1 parent 210d61f commit d89ac4c

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

src/librustc_mir/dataflow/graphviz.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ pub type Node = BasicBlock;
7373
pub struct Edge { source: BasicBlock, index: usize }
7474

7575
fn outgoing(mir: &Mir, bb: BasicBlock) -> Vec<Edge> {
76-
mir[bb].terminator().successors().enumerate()
77-
.map(|(index, _)| Edge { source: bb, index: index}).collect()
76+
(0..mir[bb].terminator().successors().count())
77+
.map(|index| Edge { source: bb, index: index}).collect()
7878
}
7979

8080
impl<'a, 'tcx, MWF, P> dot::Labeller<'a> for Graph<'a, 'tcx, MWF, P>

src/librustc_mir/dataflow/mod.rs

+1-10
Original file line numberDiff line numberDiff line change
@@ -441,23 +441,14 @@ pub struct DataflowState<O: BitDenotation>
441441
}
442442

443443
impl<O: BitDenotation> DataflowState<O> {
444-
pub fn each_bit<F>(&self, words: &IdxSet<O::Idx>, f: F) where F: FnMut(O::Idx)
445-
{
446-
words.iter().for_each(f)
447-
}
448-
449444
pub(crate) fn interpret_set<'c, P>(&self,
450445
o: &'c O,
451446
words: &IdxSet<O::Idx>,
452447
render_idx: &P)
453448
-> Vec<DebugFormatted>
454449
where P: Fn(&O, O::Idx) -> DebugFormatted
455450
{
456-
let mut v = Vec::new();
457-
self.each_bit(words, |i| {
458-
v.push(render_idx(o, i));
459-
});
460-
v
451+
words.iter().map(|i| render_idx(o, i)).collect()
461452
}
462453
}
463454

0 commit comments

Comments
 (0)