File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -226,21 +226,22 @@ fn group_cmd_specs_per_runas<'a>(
226226 let origin = |runas : Option < & RunAs > | runas. map ( |r| r as * const _ ) ;
227227
228228 let mut cmnd_specs = cmnd_specs. peekable ( ) ;
229- let mut entries = vec ! [ ] ;
230-
231- while let Some ( & ( cur_runas, _) ) = cmnd_specs. peek ( ) {
232- let specs = peeking_take_while ( & mut cmnd_specs, |& ( runas, _) | {
233- origin ( runas) == origin ( cur_runas)
234- } ) ;
235-
236- entries. push ( Entry :: new (
237- cur_runas,
238- specs. map ( |x| x. 1 ) . collect ( ) ,
239- cmnd_aliases,
240- ) ) ;
241- }
242229
243- entries. into_iter ( )
230+ std:: iter:: from_fn ( move || {
231+ if let Some ( & ( cur_runas, _) ) = cmnd_specs. peek ( ) {
232+ let specs = peeking_take_while ( & mut cmnd_specs, |& ( runas, _) | {
233+ origin ( runas) == origin ( cur_runas)
234+ } ) ;
235+
236+ Some ( Entry :: new (
237+ cur_runas,
238+ specs. map ( |x| x. 1 ) . collect ( ) ,
239+ cmnd_aliases,
240+ ) )
241+ } else {
242+ None
243+ }
244+ } )
244245}
245246
246247fn read_sudoers < R : io:: Read > ( mut reader : R ) -> io:: Result < Vec < basic_parser:: Parsed < Sudo > > > {
You can’t perform that action at this time.
0 commit comments