@@ -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 ( manifest_path) = manifest_path. as_ref ( ) {
118+ if let Some ( manifest_path) = & manifest_path {
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 ( manifest_path) = manifest_path. as_ref ( ) {
134+ if let Some ( manifest_path) = & manifest_path {
135135 package_manifest_path == manifest_path
136136 } else {
137137 let current_dir = current_dir. as_ref ( ) . expect ( "could not read current directory" ) ;
@@ -368,8 +368,8 @@ 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 ( target) = target. as_ref ( ) {
372- command. arg ( "--target" ) . arg ( & target) ;
371+ if let Some ( target) = & target {
372+ command. arg ( "--target" ) . arg ( target) ;
373373 }
374374 // Finally run it!
375375 if command. status ( ) . expect ( "failed to run xargo" ) . success ( ) . not ( ) {
@@ -379,7 +379,7 @@ 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. as_ref ( ) {
382+ let is_host = match & target {
383383 None => true ,
384384 Some ( target) => target == & rustc_version:: version_meta ( ) . unwrap ( ) . host ,
385385 } ;
@@ -404,12 +404,12 @@ fn main() {
404404 return ;
405405 }
406406
407- if let Some ( "miri" ) = std:: env:: args ( ) . nth ( 1 ) . as_ref ( ) . map ( AsRef :: as_ref ) {
407+ if let Some ( "miri" ) = std:: env:: args ( ) . nth ( 1 ) . as_deref ( ) {
408408 // This arm is for when `cargo miri` is called. We call `cargo check` for each applicable target,
409409 // but with the `RUSTC` env var set to the `cargo-miri` binary so that we come back in the other branch,
410410 // and dispatch the invocations to `rustc` and `miri`, respectively.
411411 in_cargo_miri ( ) ;
412- } else if let Some ( "rustc" ) = std:: env:: args ( ) . nth ( 1 ) . as_ref ( ) . map ( AsRef :: as_ref ) {
412+ } else if let Some ( "rustc" ) = std:: env:: args ( ) . nth ( 1 ) . as_deref ( ) {
413413 // This arm is executed when `cargo-miri` runs `cargo check` with the `RUSTC_WRAPPER` env var set to itself:
414414 // dependencies get dispatched to `rustc`, the final test/binary to `miri`.
415415 inside_cargo_rustc ( ) ;
0 commit comments