diff options
| author | Maybe Waffle <waffle.lapkin@gmail.com> | 2024-04-14 15:40:26 +0000 |
|---|---|---|
| committer | Maybe Waffle <waffle.lapkin@gmail.com> | 2024-04-14 15:48:53 +0000 |
| commit | 0d5fc9bf584f0e8700f0c3d2854bb6c70453f624 (patch) | |
| tree | 163982785183644158a7d71d90407fa85e9a41a1 /compiler/rustc_data_structures/src/graph/tests.rs | |
| parent | 398da593a53161c1ef9ca7dabbc5e9edf67deac6 (diff) | |
| download | rust-0d5fc9bf584f0e8700f0c3d2854bb6c70453f624.tar.gz rust-0d5fc9bf584f0e8700f0c3d2854bb6c70453f624.zip | |
Merge `{With,Graph}{Successors,Predecessors}` into `{Successors,Predecessors}`
Now with GAT!
Diffstat (limited to 'compiler/rustc_data_structures/src/graph/tests.rs')
| -rw-r--r-- | compiler/rustc_data_structures/src/graph/tests.rs | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/compiler/rustc_data_structures/src/graph/tests.rs b/compiler/rustc_data_structures/src/graph/tests.rs index df58b965ccf..9cd8261be6c 100644 --- a/compiler/rustc_data_structures/src/graph/tests.rs +++ b/compiler/rustc_data_structures/src/graph/tests.rs @@ -48,24 +48,18 @@ impl WithStartNode for TestGraph { } } -impl WithPredecessors for TestGraph { - fn predecessors(&self, node: usize) -> <Self as GraphPredecessors<'_>>::Iter { +impl Predecessors for TestGraph { + type Predecessors<'g> = iter::Cloned<slice::Iter<'g, usize>>; + + fn predecessors(&self, node: usize) -> Self::Predecessors<'_> { self.predecessors[&node].iter().cloned() } } -impl WithSuccessors for TestGraph { - fn successors(&self, node: usize) -> <Self as GraphSuccessors<'_>>::Iter { +impl Successors for TestGraph { + type Successors<'g> = iter::Cloned<slice::Iter<'g, usize>>; + + fn successors(&self, node: usize) -> Self::Successors<'_> { self.successors[&node].iter().cloned() } } - -impl<'graph> GraphPredecessors<'graph> for TestGraph { - type Item = usize; - type Iter = iter::Cloned<slice::Iter<'graph, usize>>; -} - -impl<'graph> GraphSuccessors<'graph> for TestGraph { - type Item = usize; - type Iter = iter::Cloned<slice::Iter<'graph, usize>>; -} |
