diff options
Diffstat (limited to 'src/librustc_data_structures/graph/vec_graph')
| -rw-r--r-- | src/librustc_data_structures/graph/vec_graph/mod.rs | 12 | ||||
| -rw-r--r-- | src/librustc_data_structures/graph/vec_graph/tests.rs | 11 |
2 files changed, 4 insertions, 19 deletions
diff --git a/src/librustc_data_structures/graph/vec_graph/mod.rs b/src/librustc_data_structures/graph/vec_graph/mod.rs index aad5944dcd0..22c50afe6d0 100644 --- a/src/librustc_data_structures/graph/vec_graph/mod.rs +++ b/src/librustc_data_structures/graph/vec_graph/mod.rs @@ -1,5 +1,5 @@ +use crate::graph::{DirectedGraph, GraphSuccessors, WithNumEdges, WithNumNodes, WithSuccessors}; use rustc_index::vec::{Idx, IndexVec}; -use crate::graph::{DirectedGraph, WithNumNodes, WithNumEdges, WithSuccessors, GraphSuccessors}; #[cfg(test)] mod tests; @@ -18,10 +18,7 @@ pub struct VecGraph<N: Idx> { } impl<N: Idx> VecGraph<N> { - pub fn new( - num_nodes: usize, - mut edge_pairs: Vec<(N, N)>, - ) -> Self { + pub fn new(num_nodes: usize, mut edge_pairs: Vec<(N, N)>) -> Self { // Sort the edges by the source -- this is important. edge_pairs.sort(); @@ -104,10 +101,7 @@ impl<N: Idx> GraphSuccessors<'graph> for VecGraph<N> { } impl<N: Idx> WithSuccessors for VecGraph<N> { - fn successors<'graph>( - &'graph self, - node: N - ) -> <Self as GraphSuccessors<'graph>>::Iter { + fn successors<'graph>(&'graph self, node: N) -> <Self as GraphSuccessors<'graph>>::Iter { self.successors(node).iter().cloned() } } diff --git a/src/librustc_data_structures/graph/vec_graph/tests.rs b/src/librustc_data_structures/graph/vec_graph/tests.rs index 97a9bd2ad0b..1db8bd4b102 100644 --- a/src/librustc_data_structures/graph/vec_graph/tests.rs +++ b/src/librustc_data_structures/graph/vec_graph/tests.rs @@ -13,16 +13,7 @@ fn create_graph() -> VecGraph<usize> { // // 6 - VecGraph::new( - 7, - vec![ - (0, 1), - (1, 2), - (1, 3), - (3, 4), - (5, 1), - ], - ) + VecGraph::new(7, vec![(0, 1), (1, 2), (1, 3), (3, 4), (5, 1)]) } #[test] |
