@@ -388,7 +388,7 @@ impl FlycheckActor {
388
388
package : Option < & str > ,
389
389
saved_file : Option < & AbsPath > ,
390
390
) -> Option < Command > {
391
- let ( mut cmd , args ) = match & self . config {
391
+ match & self . config {
392
392
FlycheckConfig :: CargoCommand { command, options, ansi_color_output } => {
393
393
let mut cmd = Command :: new ( Tool :: Cargo . path ( ) ) ;
394
394
if let Some ( sysroot_root) = & self . sysroot_root {
@@ -419,7 +419,8 @@ impl FlycheckActor {
419
419
cmd. arg ( "--keep-going" ) ;
420
420
421
421
options. apply_on_command ( & mut cmd) ;
422
- ( cmd, options. extra_args . clone ( ) )
422
+ cmd. args ( & options. extra_args ) ;
423
+ Some ( cmd)
423
424
}
424
425
FlycheckConfig :: CustomCommand {
425
426
command,
@@ -448,34 +449,31 @@ impl FlycheckActor {
448
449
}
449
450
}
450
451
451
- if args. contains ( & SAVED_FILE_PLACEHOLDER . to_owned ( ) ) {
452
- // If the custom command has a $saved_file placeholder, and
453
- // we're saving a file, replace the placeholder in the arguments.
454
- if let Some ( saved_file) = saved_file {
455
- let args = args
456
- . iter ( )
457
- . map ( |arg| {
458
- if arg == SAVED_FILE_PLACEHOLDER {
459
- saved_file. to_string ( )
460
- } else {
461
- arg. clone ( )
462
- }
463
- } )
464
- . collect ( ) ;
465
- ( cmd, args)
466
- } else {
467
- // The custom command has a $saved_file placeholder,
468
- // but we had an IDE event that wasn't a file save. Do nothing.
469
- return None ;
452
+ // If the custom command has a $saved_file placeholder, and
453
+ // we're saving a file, replace the placeholder in the arguments.
454
+ if let Some ( saved_file) = saved_file {
455
+ for arg in args {
456
+ if arg == SAVED_FILE_PLACEHOLDER {
457
+ cmd. arg ( saved_file) ;
458
+ } else {
459
+ cmd. arg ( arg) ;
460
+ }
470
461
}
471
462
} else {
472
- ( cmd, args. clone ( ) )
463
+ for arg in args {
464
+ if arg == SAVED_FILE_PLACEHOLDER {
465
+ // The custom command has a $saved_file placeholder,
466
+ // but we had an IDE event that wasn't a file save. Do nothing.
467
+ return None ;
468
+ }
469
+
470
+ cmd. arg ( arg) ;
471
+ }
473
472
}
474
- }
475
- } ;
476
473
477
- cmd. args ( args) ;
478
- Some ( cmd)
474
+ Some ( cmd)
475
+ }
476
+ }
479
477
}
480
478
481
479
fn send ( & self , check_task : FlycheckMessage ) {
0 commit comments