From 08a01825364c429675d28b326e047ce4bc56ff7f Mon Sep 17 00:00:00 2001 From: Corey Farwell Date: Sat, 3 Mar 2018 10:24:29 -0500 Subject: [PATCH] Run rustfmt on `src/librustc_data_structures/graph/mod.rs`. --- src/librustc_data_structures/graph/mod.rs | 53 +++++++++++++---------- 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/src/librustc_data_structures/graph/mod.rs b/src/librustc_data_structures/graph/mod.rs index 9ce9c738b169..1945b82c0314 100644 --- a/src/librustc_data_structures/graph/mod.rs +++ b/src/librustc_data_structures/graph/mod.rs @@ -210,16 +210,16 @@ impl Graph { .map(|(idx, e)| (EdgeIndex(idx), e)) } - pub fn each_node<'a>(&'a self, mut f: impl FnMut(NodeIndex, &'a Node) -> bool) -> bool - { + pub fn each_node<'a>(&'a self, mut f: impl FnMut(NodeIndex, &'a Node) -> 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) -> bool) -> bool - { + pub fn each_edge<'a>(&'a self, mut f: impl FnMut(EdgeIndex, &'a Edge) -> 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 { @@ -253,18 +253,19 @@ impl Graph { 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 - { + pub fn nodes_in_postorder<'a>( + &'a self, + direction: Direction, + entry_node: NodeIndex, + ) -> Vec { 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 Graph { } }; - 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 Graph { // # Iterators pub struct AdjacentEdges<'g, N, E> - where N: 'g, - E: 'g +where + N: 'g, + E: 'g, { graph: &'g Graph, 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, stack: Vec, @@ -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, - start_node: NodeIndex, - direction: Direction) - -> Self { + pub fn with_start_node( + graph: &'g Graph, + start_node: NodeIndex, + direction: Direction, + ) -> Self { let mut visited = BitVector::new(graph.len_nodes()); visited.insert(start_node.node_id()); DepthFirstTraversal {