@@ -388,7 +388,7 @@ impl FlycheckActor {
388388 package : Option < & str > ,
389389 saved_file : Option < & AbsPath > ,
390390 ) -> Option < Command > {
391- let ( mut cmd , args ) = match & self . config {
391+ match & self . config {
392392 FlycheckConfig :: CargoCommand { command, options, ansi_color_output } => {
393393 let mut cmd = Command :: new ( Tool :: Cargo . path ( ) ) ;
394394 if let Some ( sysroot_root) = & self . sysroot_root {
@@ -419,7 +419,8 @@ impl FlycheckActor {
419419 cmd. arg ( "--keep-going" ) ;
420420
421421 options. apply_on_command ( & mut cmd) ;
422- ( cmd, options. extra_args . clone ( ) )
422+ cmd. args ( & options. extra_args ) ;
423+ Some ( cmd)
423424 }
424425 FlycheckConfig :: CustomCommand {
425426 command,
@@ -448,34 +449,31 @@ impl FlycheckActor {
448449 }
449450 }
450451
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+ }
470461 }
471462 } 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+ }
473472 }
474- }
475- } ;
476473
477- cmd. args ( args) ;
478- Some ( cmd)
474+ Some ( cmd)
475+ }
476+ }
479477 }
480478
481479 fn send ( & self , check_task : FlycheckMessage ) {
0 commit comments