@@ -408,17 +408,18 @@ impl Executor for RlsExecutor {
408408 // Enforce JSON output so that we can parse the rustc output by
409409 // stripping --error-format if it was specified (e.g. Cargo pipelined
410410 // build)
411- let filtered_args = filter_arg ( cargo_cmd. get_args ( ) , "--error-format" ) ;
411+ let filtered_args =
412+ filter_arg ( & * cargo_cmd. get_args ( ) . collect :: < Vec < _ > > ( ) , "--error-format" ) ;
412413 cargo_cmd. args_replace ( & filtered_args) ;
413414 cargo_cmd. arg ( "--error-format=json" ) ;
414415 // Delete any stale data. We try and remove any json files with
415416 // the same crate name as Cargo would emit. This includes files
416417 // with the same crate name but different hashes, e.g., those
417418 // made with a different compiler.
418- let cargo_args = cargo_cmd. get_args ( ) ;
419+ let cargo_args = cargo_cmd. get_args ( ) . collect :: < Vec < _ > > ( ) ;
419420 let crate_name =
420- parse_arg ( cargo_args, "--crate-name" ) . expect ( "no crate-name in rustc command line" ) ;
421- let cfg_test = cargo_args. iter ( ) . any ( |arg| arg == "--test" ) ;
421+ parse_arg ( & cargo_args, "--crate-name" ) . expect ( "no crate-name in rustc command line" ) ;
422+ let cfg_test = cargo_args. iter ( ) . any ( |arg| * arg == "--test" ) ;
422423 trace ! ( "exec: {} {:?}" , crate_name, cargo_cmd) ;
423424
424425 // Send off a window/progress notification for this compile target.
@@ -435,7 +436,8 @@ impl Executor for RlsExecutor {
435436 . expect ( "failed to send progress update" ) ;
436437 }
437438
438- let out_dir = parse_arg ( cargo_args, "--out-dir" ) . expect ( "no out-dir in rustc command line" ) ;
439+ let out_dir =
440+ parse_arg ( & cargo_args, "--out-dir" ) . expect ( "no out-dir in rustc command line" ) ;
439441 let analysis_dir = Path :: new ( & out_dir) . join ( "save-analysis" ) ;
440442 if let Ok ( dir_contents) = read_dir ( & analysis_dir) {
441443 let lib_crate_name = "lib" . to_owned ( ) + & crate_name;
@@ -478,7 +480,7 @@ impl Executor for RlsExecutor {
478480
479481 // Add args and envs to cmd.
480482 let mut args: Vec < _ > =
481- cargo_args. iter ( ) . map ( |a| a . clone ( ) . into_string ( ) . unwrap ( ) ) . collect ( ) ;
483+ cargo_args. iter ( ) . map ( |a| ( * a ) . to_owned ( ) . into_string ( ) . unwrap ( ) ) . collect ( ) ;
482484 let envs = cargo_cmd. get_envs ( ) . clone ( ) ;
483485
484486 let sysroot = super :: rustc:: current_sysroot ( )
@@ -508,7 +510,7 @@ impl Executor for RlsExecutor {
508510 "rustc not intercepted - {}{} - args: {:?} envs: {:?}" ,
509511 id. name( ) ,
510512 build_script_notice,
511- cmd. get_args( ) ,
513+ cmd. get_args( ) . collect :: < Vec <_>> ( ) ,
512514 cmd. get_envs( ) ,
513515 ) ;
514516
@@ -712,9 +714,9 @@ pub fn make_cargo_config(
712714 config
713715}
714716
715- fn parse_arg ( args : & [ OsString ] , arg : & str ) -> Option < String > {
717+ fn parse_arg ( args : & [ & OsString ] , arg : & str ) -> Option < String > {
716718 for ( i, a) in args. iter ( ) . enumerate ( ) {
717- if a == arg {
719+ if * a == arg {
718720 return Some ( args[ i + 1 ] . clone ( ) . into_string ( ) . unwrap ( ) ) ;
719721 }
720722 }
@@ -780,7 +782,7 @@ fn dedup_flags(flag_str: &str) -> String {
780782}
781783
782784/// Removes a selected flag of a `--flag=VALUE` or `--flag VALUE` shape from `args` (command line args for Rust).
783- fn filter_arg ( args : & [ OsString ] , key : & str ) -> Vec < String > {
785+ fn filter_arg ( args : & [ & OsString ] , key : & str ) -> Vec < String > {
784786 let key_as_prefix = key. to_owned ( ) + "=" ;
785787 let mut ret = vec ! [ ] ;
786788
0 commit comments