@@ -215,8 +215,10 @@ where
215215 where
216216 G :: Map : Default ,
217217 {
218- let mut dfs_post_order = DfsPostOrder :: default ( ) ;
219- dfs_post_order. stack = Vec :: with_capacity ( max_nodes) ;
218+ let dfs_post_order = DfsPostOrder {
219+ stack : Vec :: with_capacity ( max_nodes) ,
220+ ..Default :: default ( )
221+ } ;
220222 let inputs = Vec :: with_capacity ( max_nodes) ;
221223 Self {
222224 dfs_post_order,
@@ -346,29 +348,23 @@ where
346348/// Produce an iterator yielding IDs for all **source** nodes within the graph.
347349///
348350/// A node is considered to be a source node if it has no incoming edges.
349- pub fn sources < ' a , G > ( g : & ' a G ) -> impl ' a + Iterator < Item = G :: NodeId >
351+ pub fn sources < G > ( g : & G ) -> impl ' _ + Iterator < Item = G :: NodeId >
350352where
351353 G : IntoNeighborsDirected + NodeCount + NodeIndexable ,
352354{
353355 ( 0 ..g. node_count ( ) )
354356 . map ( move |ix| g. from_index ( ix) )
355- . filter_map ( move |id| match g. neighbors_directed ( id, Incoming ) . next ( ) {
356- None => Some ( id) ,
357- _ => None ,
358- } )
357+ . filter ( move |id| g. neighbors_directed ( * id, Incoming ) . next ( ) . is_none ( ) )
359358}
360359
361360/// Produce an iterator yielding IDs for all **sink** nodes within the graph.
362361///
363362/// A node is considered to be a **sink** node if it has no outgoing edges.
364- pub fn sinks < ' a , G > ( g : & ' a G ) -> impl ' a + Iterator < Item = G :: NodeId >
363+ pub fn sinks < G > ( g : & G ) -> impl ' _ + Iterator < Item = G :: NodeId >
365364where
366365 G : IntoNeighborsDirected + NodeCount + NodeIndexable ,
367366{
368367 ( 0 ..g. node_count ( ) )
369368 . map ( move |ix| g. from_index ( ix) )
370- . filter_map ( move |id| match g. neighbors_directed ( id, Outgoing ) . next ( ) {
371- None => Some ( id) ,
372- _ => None ,
373- } )
369+ . filter ( move |id| g. neighbors_directed ( * id, Outgoing ) . next ( ) . is_none ( ) )
374370}
0 commit comments