diff options
| author | 许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com> | 2024-04-15 16:56:18 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-15 16:56:18 +0100 |
| commit | 5580ae979579c7ca19b7fd5c55f7f82914ac4d5c (patch) | |
| tree | de3a7244aae541b23957abee763ee6a329853bc6 /compiler/rustc_data_structures/src/graph/reference.rs | |
| parent | b79d0b08493c535048223f22d8d2cdec8bf4f39b (diff) | |
| parent | 435db9b9bd404c1bc632fbb6ade8b4ce92c2828c (diff) | |
| download | rust-5580ae979579c7ca19b7fd5c55f7f82914ac4d5c.tar.gz rust-5580ae979579c7ca19b7fd5c55f7f82914ac4d5c.zip | |
Rollup merge of #123934 - WaffleLapkin:graph-mini-refactor, r=fmease
`rustc_data_structures::graph` mini refactor Who doesn't love to breathe dust from the ancient times?
Diffstat (limited to 'compiler/rustc_data_structures/src/graph/reference.rs')
| -rw-r--r-- | compiler/rustc_data_structures/src/graph/reference.rs | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/compiler/rustc_data_structures/src/graph/reference.rs b/compiler/rustc_data_structures/src/graph/reference.rs index c259fe56c15..7a487552f53 100644 --- a/compiler/rustc_data_structures/src/graph/reference.rs +++ b/compiler/rustc_data_structures/src/graph/reference.rs @@ -2,38 +2,26 @@ use super::*; impl<'graph, G: DirectedGraph> DirectedGraph for &'graph G { type Node = G::Node; -} -impl<'graph, G: WithNumNodes> WithNumNodes for &'graph G { fn num_nodes(&self) -> usize { (**self).num_nodes() } } -impl<'graph, G: WithStartNode> WithStartNode for &'graph G { +impl<'graph, G: StartNode> StartNode for &'graph G { fn start_node(&self) -> Self::Node { (**self).start_node() } } -impl<'graph, G: WithSuccessors> WithSuccessors for &'graph G { - fn successors(&self, node: Self::Node) -> <Self as GraphSuccessors<'_>>::Iter { +impl<'graph, G: Successors> Successors for &'graph G { + fn successors(&self, node: Self::Node) -> impl Iterator<Item = Self::Node> { (**self).successors(node) } } -impl<'graph, G: WithPredecessors> WithPredecessors for &'graph G { - fn predecessors(&self, node: Self::Node) -> <Self as GraphPredecessors<'_>>::Iter { +impl<'graph, G: Predecessors> Predecessors for &'graph G { + fn predecessors(&self, node: Self::Node) -> impl Iterator<Item = Self::Node> { (**self).predecessors(node) } } - -impl<'iter, 'graph, G: WithPredecessors> GraphPredecessors<'iter> for &'graph G { - type Item = G::Node; - type Iter = <G as GraphPredecessors<'iter>>::Iter; -} - -impl<'iter, 'graph, G: WithSuccessors> GraphSuccessors<'iter> for &'graph G { - type Item = G::Node; - type Iter = <G as GraphSuccessors<'iter>>::Iter; -} |
