about summary refs log tree commit diff
path: root/src/librustc_data_structures/graph
diff options
context:
space:
mode:
authorCorey Farwell <coreyf@rwell.org>2018-03-03 10:24:29 -0500
committerCorey Farwell <coreyf@rwell.org>2018-03-07 20:10:01 -0500
commit08a01825364c429675d28b326e047ce4bc56ff7f (patch)
tree99130865bd6f2147e8b3a51a86559ab8fa2fa56d /src/librustc_data_structures/graph
parent3e60d996a00c6151b635994820edeb43ffd12e6c (diff)
downloadrust-08a01825364c429675d28b326e047ce4bc56ff7f.tar.gz
rust-08a01825364c429675d28b326e047ce4bc56ff7f.zip
Run rustfmt on `src/librustc_data_structures/graph/mod.rs`.
Diffstat (limited to 'src/librustc_data_structures/graph')
-rw-r--r--src/librustc_data_structures/graph/mod.rs53
1 files changed, 29 insertions, 24 deletions
diff --git a/src/librustc_data_structures/graph/mod.rs b/src/librustc_data_structures/graph/mod.rs
index 9ce9c738b16..1945b82c031 100644
--- a/src/librustc_data_structures/graph/mod.rs
+++ b/src/librustc_data_structures/graph/mod.rs
@@ -210,16 +210,16 @@ impl<N: Debug, E: Debug> Graph<N, E> {
             .map(|(idx, e)| (EdgeIndex(idx), e))
     }
 
-    pub fn each_node<'a>(&'a self, mut f: impl FnMut(NodeIndex, &'a Node<N>) -> bool) -> bool
-    {
+    pub fn each_node<'a>(&'a self, mut f: impl FnMut(NodeIndex, &'a Node<N>) -> bool) -> bool {
         //! Iterates over all edges defined in the graph.
-        self.enumerated_nodes().all(|(node_idx, node)| f(node_idx, node))
+        self.enumerated_nodes()
+            .all(|(node_idx, node)| f(node_idx, node))
     }
 
-    pub fn each_edge<'a>(&'a self, mut f: impl FnMut(EdgeIndex, &'a Edge<E>) -> bool) -> bool
-    {
+    pub fn each_edge<'a>(&'a self, mut f: impl FnMut(EdgeIndex, &'a Edge<E>) -> bool) -> bool {
         //! Iterates over all edges defined in the graph
-        self.enumerated_edges().all(|(edge_idx, edge)| f(edge_idx, edge))
+        self.enumerated_edges()
+            .all(|(edge_idx, edge)| f(edge_idx, edge))
     }
 
     pub fn outgoing_edges(&self, source: NodeIndex) -> AdjacentEdges<N, E> {
@@ -253,18 +253,19 @@ impl<N: Debug, E: Debug> Graph<N, E> {
         self.incoming_edges(target).sources()
     }
 
-    pub fn depth_traverse<'a>(&'a self,
-                              start: NodeIndex,
-                              direction: Direction)
-                              -> DepthFirstTraversal<'a, N, E> {
+    pub fn depth_traverse<'a>(
+        &'a self,
+        start: NodeIndex,
+        direction: Direction,
+    ) -> DepthFirstTraversal<'a, N, E> {
         DepthFirstTraversal::with_start_node(self, start, direction)
     }
 
-    pub fn nodes_in_postorder<'a>(&'a self,
-                                  direction: Direction,
-                                  entry_node: NodeIndex)
-                                  -> Vec<NodeIndex>
-    {
+    pub fn nodes_in_postorder<'a>(
+        &'a self,
+        direction: Direction,
+        entry_node: NodeIndex,
+    ) -> Vec<NodeIndex> {
         let mut visited = BitVector::new(self.len_nodes());
         let mut stack = vec![];
         let mut result = Vec::with_capacity(self.len_nodes());
@@ -274,7 +275,8 @@ impl<N: Debug, E: Debug> Graph<N, E> {
             }
         };
 
-        for node in Some(entry_node).into_iter()
+        for node in Some(entry_node)
+            .into_iter()
             .chain(self.enumerated_nodes().map(|(node, _)| node))
         {
             push_node(&mut stack, node);
@@ -300,8 +302,9 @@ impl<N: Debug, E: Debug> Graph<N, E> {
 // # Iterators
 
 pub struct AdjacentEdges<'g, N, E>
-    where N: 'g,
-          E: 'g
+where
+    N: 'g,
+    E: 'g,
 {
     graph: &'g Graph<N, E>,
     direction: Direction,
@@ -334,8 +337,9 @@ impl<'g, N: Debug, E: Debug> Iterator for AdjacentEdges<'g, N, E> {
 }
 
 pub struct DepthFirstTraversal<'g, N, E>
-    where N: 'g,
-          E: 'g
+where
+    N: 'g,
+    E: 'g,
 {
     graph: &'g Graph<N, E>,
     stack: Vec<NodeIndex>,
@@ -344,10 +348,11 @@ pub struct DepthFirstTraversal<'g, N, E>
 }
 
 impl<'g, N: Debug, E: Debug> DepthFirstTraversal<'g, N, E> {
-    pub fn with_start_node(graph: &'g Graph<N, E>,
-                           start_node: NodeIndex,
-                           direction: Direction)
-                           -> Self {
+    pub fn with_start_node(
+        graph: &'g Graph<N, E>,
+        start_node: NodeIndex,
+        direction: Direction,
+    ) -> Self {
         let mut visited = BitVector::new(graph.len_nodes());
         visited.insert(start_node.node_id());
         DepthFirstTraversal {