File tree Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -114,12 +114,9 @@ pub(super) fn run_spawn_hooks(thread: &Thread) -> ChildSpawnHooks {
114
114
snapshot
115
115
} ) ;
116
116
// Iterate over the hooks, run them, and collect the results in a vector.
117
- let mut next: & Option < Arc < SpawnHook > > = & hooks. first ;
118
- let mut to_run = Vec :: new ( ) ;
119
- while let Some ( hook) = next {
120
- to_run. push ( ( hook. hook ) ( thread) ) ;
121
- next = & hook. next ;
122
- }
117
+ let to_run: Vec < _ > = std:: iter:: successors ( hooks. first . as_deref ( ) , |hook| hook. next . as_deref ( ) )
118
+ . map ( |hook| ( hook. hook ) ( thread) )
119
+ . collect ( ) ;
123
120
// Pass on the snapshot of the hooks and the results to the new thread,
124
121
// which will then run SpawnHookResults::run().
125
122
ChildSpawnHooks { hooks, to_run }
You can’t perform that action at this time.
0 commit comments