@@ -257,12 +257,7 @@ impl Toolchain {
257257 }
258258 ( None , None ) => {
259259 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) ;
266261 cmd
267262 }
268263 ( Some ( script) , Some ( timeout) ) => {
@@ -277,12 +272,7 @@ impl Toolchain {
277272 let mut cmd = Command :: new ( "timeout" ) ;
278273 cmd. arg ( timeout. to_string ( ) ) ;
279274 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) ;
286276 cmd
287277 }
288278 } ;
@@ -322,6 +312,15 @@ impl Toolchain {
322312 output
323313 }
324314
315+ fn set_cargo_args_and_envs ( & self , cmd : & mut Command , cfg : & Config ) {
316+ cmd. arg ( & format ! ( "+{}" , self . rustup_name( ) ) ) ;
317+ if cfg. args . command_args . is_empty ( ) {
318+ cmd. arg ( "build" ) ;
319+ } else {
320+ cmd. args ( & cfg. args . command_args ) ;
321+ }
322+ }
323+
325324 pub ( crate ) fn test ( & self , cfg : & Config ) -> TestOutcome {
326325 eprintln ! ( "testing..." ) ;
327326 let outcome = if cfg. args . prompt {
0 commit comments