@@ -115,7 +115,7 @@ fn list_targets() -> impl Iterator<Item = cargo_metadata::Target> {
115115 get_arg_flag_value ( "--manifest-path" ) . map ( |m| Path :: new ( & m) . canonicalize ( ) . unwrap ( ) ) ;
116116
117117 let mut cmd = cargo_metadata:: MetadataCommand :: new ( ) ;
118- if let Some ( ref manifest_path) = manifest_path {
118+ if let Some ( manifest_path) = manifest_path. as_ref ( ) {
119119 cmd. manifest_path ( manifest_path) ;
120120 }
121121 let mut metadata = if let Ok ( metadata) = cmd. exec ( ) {
@@ -131,7 +131,7 @@ fn list_targets() -> impl Iterator<Item = cargo_metadata::Target> {
131131 . iter ( )
132132 . position ( |package| {
133133 let package_manifest_path = Path :: new ( & package. manifest_path ) ;
134- if let Some ( ref manifest_path) = manifest_path {
134+ if let Some ( manifest_path) = manifest_path. as_ref ( ) {
135135 package_manifest_path == manifest_path
136136 } else {
137137 let current_dir = current_dir. as_ref ( ) . expect ( "could not read current directory" ) ;
@@ -368,7 +368,7 @@ path = "lib.rs"
368368 command. env ( "XARGO_HOME" , & dir) ;
369369 command. env ( "XARGO_RUST_SRC" , & rust_src) ;
370370 // Handle target flag.
371- if let Some ( ref target) = target {
371+ if let Some ( target) = target. as_ref ( ) {
372372 command. arg ( "--target" ) . arg ( & target) ;
373373 }
374374 // Finally run it!
@@ -379,9 +379,9 @@ path = "lib.rs"
379379 // That should be it! But we need to figure out where xargo built stuff.
380380 // Unfortunately, it puts things into a different directory when the
381381 // architecture matches the host.
382- let is_host = match target {
382+ let is_host = match target. as_ref ( ) {
383383 None => true ,
384- Some ( target) => target == rustc_version:: version_meta ( ) . unwrap ( ) . host ,
384+ Some ( target) => target == & rustc_version:: version_meta ( ) . unwrap ( ) . host ,
385385 } ;
386386 let sysroot = if is_host { dir. join ( "HOST" ) } else { PathBuf :: from ( dir) } ;
387387 std:: env:: set_var ( "MIRI_SYSROOT" , & sysroot) ; // pass the env var to the processes we spawn, which will turn it into "--sysroot" flags
@@ -583,6 +583,6 @@ fn inside_cargo_rustc() {
583583 if !exit. success ( ) {
584584 std:: process:: exit ( exit. code ( ) . unwrap_or ( 42 ) ) ;
585585 } ,
586- Err ( ref e) => panic ! ( "error running {:?}:\n {:?}" , command, e) ,
586+ Err ( e) => panic ! ( "error running {:?}:\n {:?}" , command, e) ,
587587 }
588588}
0 commit comments