File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ use std::ffi::{OsStr, OsString};
11
11
use std:: fmt;
12
12
use std:: fs:: { File , OpenOptions } ;
13
13
use std:: io:: { Error , ErrorKind , Result } ;
14
+ use std:: mem:: take;
14
15
use std:: path:: { Path , PathBuf } ;
15
16
use std:: process:: Command ;
16
17
use std:: sync:: Mutex ;
@@ -160,7 +161,7 @@ impl GroupCmds {
160
161
#[ doc( hidden) ]
161
162
#[ derive( Default ) ]
162
163
pub struct Cmds {
163
- cmds : Vec < Option < Cmd > > ,
164
+ cmds : Vec < Cmd > ,
164
165
full_cmds : String ,
165
166
ignore_error : bool ,
166
167
file : String ,
@@ -188,7 +189,7 @@ impl Cmds {
188
189
) ;
189
190
}
190
191
}
191
- self . cmds . push ( Some ( cmd) ) ;
192
+ self . cmds . push ( cmd) ;
192
193
self
193
194
}
194
195
@@ -204,8 +205,7 @@ impl Cmds {
204
205
let mut children: Vec < CmdChild > = Vec :: new ( ) ;
205
206
let len = self . cmds . len ( ) ;
206
207
let mut prev_pipe_in = None ;
207
- for ( i, cmd_opt) in self . cmds . iter_mut ( ) . enumerate ( ) {
208
- let mut cmd = cmd_opt. take ( ) . unwrap ( ) ;
208
+ for ( i, mut cmd) in take ( & mut self . cmds ) . into_iter ( ) . enumerate ( ) {
209
209
if i != len - 1 {
210
210
// not the last, update redirects
211
211
let ( pipe_reader, pipe_writer) =
You can’t perform that action at this time.
0 commit comments