Skip to content

Commit 1715b59

Browse files
committed
---
yaml --- r: 165408 b: refs/heads/master c: b4f54f9 h: refs/heads/master v: v3
1 parent a8b3566 commit 1715b59

File tree

4 files changed

+5
-10
lines changed

4 files changed

+5
-10
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 9115b319c31d644f01387c9fe3eff9a498941090
2+
refs/heads/master: b4f54f96df60337cb939f6f753a1cc6181e70f4b
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 658529467d9d69ac9e09cacf98a6d61d781c2c76
55
refs/heads/try: aee614fc4973262a5a68efc643026e2b1458d65b

trunk/src/librustc/middle/cfg/mod.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,6 @@ impl CFG {
5151
}
5252

5353
pub fn node_is_reachable(&self, id: ast::NodeId) -> bool {
54-
for node in self.graph.depth_traverse(self.entry) {
55-
if node.id == id { return true }
56-
}
57-
return false;
54+
self.graph.depth_traverse(self.entry).any(|node| node.id == id)
5855
}
5956
}

trunk/src/librustc/middle/graph.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -313,12 +313,10 @@ pub struct DepthFirstTraversal<'g, N:'g, E:'g> {
313313

314314
impl<'g, N, E> Iterator<&'g N> for DepthFirstTraversal<'g, N, E> {
315315
fn next(&mut self) -> Option<&'g N> {
316-
while self.stack.len() > 0 {
317-
let idx = self.stack.pop().unwrap();
318-
if self.visited.contains(&idx.node_id()) {
316+
while let Some(idx) = self.stack.pop() {
317+
if self.visited.insert(idx.node_id()) {
319318
continue;
320319
}
321-
self.visited.insert(idx.node_id());
322320
self.graph.each_outgoing_edge(idx, |_, e| -> bool {
323321
if !self.visited.contains(&e.target().node_id()) {
324322
self.stack.push(e.target());

trunk/src/librustc_trans/trans/base.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1468,7 +1468,7 @@ pub fn new_fn_ctxt<'a, 'tcx>(ccx: &'a CrateContext<'a, 'tcx>,
14681468
let debug_context = debuginfo::create_function_debug_context(ccx, id, param_substs, llfndecl);
14691469
let (blk_id, cfg) = build_cfg(ccx.tcx(), id);
14701470
let nested_returns = if let Some(ref cfg) = cfg {
1471-
has_nested_returns(ccx.tcx(), cfg, blk_id)
1471+
has_nested_returns(ccx.tcx(), cfg, blk_id)
14721472
} else {
14731473
false
14741474
};

0 commit comments

Comments
 (0)