about summary refs log tree commit diff
path: root/src/librustc/cfg/construct.rs
diff options
context:
space:
mode:
authorljedrz <ljedrz@gmail.com>2018-07-26 17:11:10 +0200
committerljedrz <ljedrz@gmail.com>2018-07-29 18:53:22 +0200
commit59c8a279daf6912b99ba089ff6dafbfc3469831e (patch)
treeab821f37fca36aa9730bed95c0cad5fbf3e9eaa4 /src/librustc/cfg/construct.rs
parenta5c2d0fffaaf0b764c01bc4066e51ffd475ceae9 (diff)
downloadrust-59c8a279daf6912b99ba089ff6dafbfc3469831e.tar.gz
rust-59c8a279daf6912b99ba089ff6dafbfc3469831e.zip
Replace push loops with collect() and extend() where possible
Diffstat (limited to 'src/librustc/cfg/construct.rs')
-rw-r--r--src/librustc/cfg/construct.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/librustc/cfg/construct.rs b/src/librustc/cfg/construct.rs
index f1e27946915..98cfa094c16 100644
--- a/src/librustc/cfg/construct.rs
+++ b/src/librustc/cfg/construct.rs
@@ -567,12 +567,12 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
     fn add_returning_edge(&mut self,
                           _from_expr: &hir::Expr,
                           from_index: CFGIndex) {
-        let mut data = CFGEdgeData {
-            exiting_scopes: vec![],
+        let data = CFGEdgeData {
+            exiting_scopes: self.loop_scopes.iter()
+                                            .rev()
+                                            .map(|&LoopScope { loop_id: id, .. }| id)
+                                            .collect()
         };
-        for &LoopScope { loop_id: id, .. } in self.loop_scopes.iter().rev() {
-            data.exiting_scopes.push(id);
-        }
         self.graph.add_edge(from_index, self.fn_exit, data);
     }