Greatly simplify lifetime captures in edition 2024
This commit is contained in:
@@ -193,11 +193,11 @@ impl<N: Debug, E: Debug> Graph<N, E> {
|
||||
AdjacentEdges { graph: self, direction, next: first_edge }
|
||||
}
|
||||
|
||||
pub fn successor_nodes(&self, source: NodeIndex) -> impl Iterator<Item = NodeIndex> + '_ {
|
||||
pub fn successor_nodes(&self, source: NodeIndex) -> impl Iterator<Item = NodeIndex> {
|
||||
self.outgoing_edges(source).targets()
|
||||
}
|
||||
|
||||
pub fn predecessor_nodes(&self, target: NodeIndex) -> impl Iterator<Item = NodeIndex> + '_ {
|
||||
pub fn predecessor_nodes(&self, target: NodeIndex) -> impl Iterator<Item = NodeIndex> {
|
||||
self.incoming_edges(target).sources()
|
||||
}
|
||||
|
||||
@@ -255,11 +255,11 @@ pub struct AdjacentEdges<'g, N, E> {
|
||||
}
|
||||
|
||||
impl<'g, N: Debug, E: Debug> AdjacentEdges<'g, N, E> {
|
||||
fn targets(self) -> impl Iterator<Item = NodeIndex> + 'g {
|
||||
fn targets(self) -> impl Iterator<Item = NodeIndex> {
|
||||
self.map(|(_, edge)| edge.target)
|
||||
}
|
||||
|
||||
fn sources(self) -> impl Iterator<Item = NodeIndex> + 'g {
|
||||
fn sources(self) -> impl Iterator<Item = NodeIndex> {
|
||||
self.map(|(_, edge)| edge.source)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ impl<N: Idx, S: Idx + Ord, A: Annotation> Sccs<N, S, A> {
|
||||
/// meaning that if `S1 -> S2`, we will visit `S2` first and `S1` after.
|
||||
/// This is convenient when the edges represent dependencies: when you visit
|
||||
/// `S1`, the value for `S2` will already have been computed.
|
||||
pub fn all_sccs(&self) -> impl Iterator<Item = S> + use<N, S, A> {
|
||||
pub fn all_sccs(&self) -> impl Iterator<Item = S> + 'static {
|
||||
(0..self.scc_data.len()).map(S::new)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user