Skip to content

Commit 08a0182

Browse files
committed
Run rustfmt on src/librustc_data_structures/graph/mod.rs.
1 parent 3e60d99 commit 08a0182

File tree

1 file changed

+29
-24
lines changed
  • src/librustc_data_structures/graph

1 file changed

+29
-24
lines changed

src/librustc_data_structures/graph/mod.rs

+29-24
Original file line numberDiff line numberDiff line change
@@ -210,16 +210,16 @@ impl<N: Debug, E: Debug> Graph<N, E> {
210210
.map(|(idx, e)| (EdgeIndex(idx), e))
211211
}
212212

213-
pub fn each_node<'a>(&'a self, mut f: impl FnMut(NodeIndex, &'a Node<N>) -> bool) -> bool
214-
{
213+
pub fn each_node<'a>(&'a self, mut f: impl FnMut(NodeIndex, &'a Node<N>) -> bool) -> bool {
215214
//! Iterates over all edges defined in the graph.
216-
self.enumerated_nodes().all(|(node_idx, node)| f(node_idx, node))
215+
self.enumerated_nodes()
216+
.all(|(node_idx, node)| f(node_idx, node))
217217
}
218218

219-
pub fn each_edge<'a>(&'a self, mut f: impl FnMut(EdgeIndex, &'a Edge<E>) -> bool) -> bool
220-
{
219+
pub fn each_edge<'a>(&'a self, mut f: impl FnMut(EdgeIndex, &'a Edge<E>) -> bool) -> bool {
221220
//! Iterates over all edges defined in the graph
222-
self.enumerated_edges().all(|(edge_idx, edge)| f(edge_idx, edge))
221+
self.enumerated_edges()
222+
.all(|(edge_idx, edge)| f(edge_idx, edge))
223223
}
224224

225225
pub fn outgoing_edges(&self, source: NodeIndex) -> AdjacentEdges<N, E> {
@@ -253,18 +253,19 @@ impl<N: Debug, E: Debug> Graph<N, E> {
253253
self.incoming_edges(target).sources()
254254
}
255255

256-
pub fn depth_traverse<'a>(&'a self,
257-
start: NodeIndex,
258-
direction: Direction)
259-
-> DepthFirstTraversal<'a, N, E> {
256+
pub fn depth_traverse<'a>(
257+
&'a self,
258+
start: NodeIndex,
259+
direction: Direction,
260+
) -> DepthFirstTraversal<'a, N, E> {
260261
DepthFirstTraversal::with_start_node(self, start, direction)
261262
}
262263

263-
pub fn nodes_in_postorder<'a>(&'a self,
264-
direction: Direction,
265-
entry_node: NodeIndex)
266-
-> Vec<NodeIndex>
267-
{
264+
pub fn nodes_in_postorder<'a>(
265+
&'a self,
266+
direction: Direction,
267+
entry_node: NodeIndex,
268+
) -> Vec<NodeIndex> {
268269
let mut visited = BitVector::new(self.len_nodes());
269270
let mut stack = vec![];
270271
let mut result = Vec::with_capacity(self.len_nodes());
@@ -274,7 +275,8 @@ impl<N: Debug, E: Debug> Graph<N, E> {
274275
}
275276
};
276277

277-
for node in Some(entry_node).into_iter()
278+
for node in Some(entry_node)
279+
.into_iter()
278280
.chain(self.enumerated_nodes().map(|(node, _)| node))
279281
{
280282
push_node(&mut stack, node);
@@ -300,8 +302,9 @@ impl<N: Debug, E: Debug> Graph<N, E> {
300302
// # Iterators
301303

302304
pub struct AdjacentEdges<'g, N, E>
303-
where N: 'g,
304-
E: 'g
305+
where
306+
N: 'g,
307+
E: 'g,
305308
{
306309
graph: &'g Graph<N, E>,
307310
direction: Direction,
@@ -334,8 +337,9 @@ impl<'g, N: Debug, E: Debug> Iterator for AdjacentEdges<'g, N, E> {
334337
}
335338

336339
pub struct DepthFirstTraversal<'g, N, E>
337-
where N: 'g,
338-
E: 'g
340+
where
341+
N: 'g,
342+
E: 'g,
339343
{
340344
graph: &'g Graph<N, E>,
341345
stack: Vec<NodeIndex>,
@@ -344,10 +348,11 @@ pub struct DepthFirstTraversal<'g, N, E>
344348
}
345349

346350
impl<'g, N: Debug, E: Debug> DepthFirstTraversal<'g, N, E> {
347-
pub fn with_start_node(graph: &'g Graph<N, E>,
348-
start_node: NodeIndex,
349-
direction: Direction)
350-
-> Self {
351+
pub fn with_start_node(
352+
graph: &'g Graph<N, E>,
353+
start_node: NodeIndex,
354+
direction: Direction,
355+
) -> Self {
351356
let mut visited = BitVector::new(graph.len_nodes());
352357
visited.insert(start_node.node_id());
353358
DepthFirstTraversal {

0 commit comments

Comments
 (0)