From 0d5fc9bf584f0e8700f0c3d2854bb6c70453f624 Mon Sep 17 00:00:00 2001 From: Maybe Waffle Date: Sun, 14 Apr 2024 15:40:26 +0000 Subject: Merge `{With,Graph}{Successors,Predecessors}` into `{Successors,Predecessors}` Now with GAT! --- compiler/rustc_data_structures/src/graph/vec_graph/mod.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'compiler/rustc_data_structures/src/graph/vec_graph') diff --git a/compiler/rustc_data_structures/src/graph/vec_graph/mod.rs b/compiler/rustc_data_structures/src/graph/vec_graph/mod.rs index 79efe3fb8e0..8b75fd9f633 100644 --- a/compiler/rustc_data_structures/src/graph/vec_graph/mod.rs +++ b/compiler/rustc_data_structures/src/graph/vec_graph/mod.rs @@ -1,4 +1,4 @@ -use crate::graph::{DirectedGraph, GraphSuccessors, WithNumEdges, WithSuccessors}; +use crate::graph::{DirectedGraph, Successors, WithNumEdges}; use rustc_index::{Idx, IndexVec}; #[cfg(test)] @@ -92,14 +92,10 @@ impl WithNumEdges for VecGraph { } } -impl<'graph, N: Idx> GraphSuccessors<'graph> for VecGraph { - type Item = N; +impl Successors for VecGraph { + type Successors<'g> = std::iter::Cloned>; - type Iter = std::iter::Cloned>; -} - -impl WithSuccessors for VecGraph { - fn successors(&self, node: N) -> >::Iter { + fn successors(&self, node: N) -> Self::Successors<'_> { self.successors(node).iter().cloned() } } -- cgit 1.4.1-3-g733a5