@@ -257,12 +257,7 @@ impl Toolchain {
257
257
}
258
258
( None , None ) => {
259
259
let mut cmd = Command :: new ( "cargo" ) ;
260
- cmd. arg ( & format ! ( "+{}" , self . rustup_name( ) ) ) ;
261
- if cfg. args . command_args . is_empty ( ) {
262
- cmd. arg ( "build" ) ;
263
- } else {
264
- cmd. args ( & cfg. args . command_args ) ;
265
- }
260
+ self . set_cargo_args_and_envs ( & mut cmd, cfg) ;
266
261
cmd
267
262
}
268
263
( Some ( script) , Some ( timeout) ) => {
@@ -277,12 +272,7 @@ impl Toolchain {
277
272
let mut cmd = Command :: new ( "timeout" ) ;
278
273
cmd. arg ( timeout. to_string ( ) ) ;
279
274
cmd. arg ( "cargo" ) ;
280
- cmd. arg ( format ! ( "+{}" , self . rustup_name( ) ) ) ;
281
- if cfg. args . command_args . is_empty ( ) {
282
- cmd. arg ( "build" ) ;
283
- } else {
284
- cmd. args ( & cfg. args . command_args ) ;
285
- }
275
+ self . set_cargo_args_and_envs ( & mut cmd, cfg) ;
286
276
cmd
287
277
}
288
278
} ;
@@ -326,6 +316,15 @@ impl Toolchain {
326
316
output
327
317
}
328
318
319
+ fn set_cargo_args_and_envs ( & self , cmd : & mut Command , cfg : & Config ) {
320
+ cmd. arg ( & format ! ( "+{}" , self . rustup_name( ) ) ) ;
321
+ if cfg. args . command_args . is_empty ( ) {
322
+ cmd. arg ( "build" ) ;
323
+ } else {
324
+ cmd. args ( & cfg. args . command_args ) ;
325
+ }
326
+ }
327
+
329
328
pub ( crate ) fn test ( & self , cfg : & Config ) -> TestOutcome {
330
329
eprintln ! ( "testing..." ) ;
331
330
let outcome = if cfg. args . prompt {
0 commit comments