@@ -115,7 +115,7 @@ fn list_targets() -> impl Iterator<Item = cargo_metadata::Target> {
115
115
get_arg_flag_value ( "--manifest-path" ) . map ( |m| Path :: new ( & m) . canonicalize ( ) . unwrap ( ) ) ;
116
116
117
117
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 {
119
119
cmd. manifest_path ( manifest_path) ;
120
120
}
121
121
let mut metadata = if let Ok ( metadata) = cmd. exec ( ) {
@@ -131,7 +131,7 @@ fn list_targets() -> impl Iterator<Item = cargo_metadata::Target> {
131
131
. iter ( )
132
132
. position ( |package| {
133
133
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 {
135
135
package_manifest_path == manifest_path
136
136
} else {
137
137
let current_dir = current_dir. as_ref ( ) . expect ( "could not read current directory" ) ;
@@ -368,8 +368,8 @@ path = "lib.rs"
368
368
command. env ( "XARGO_HOME" , & dir) ;
369
369
command. env ( "XARGO_RUST_SRC" , & rust_src) ;
370
370
// 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) ;
373
373
}
374
374
// Finally run it!
375
375
if command. status ( ) . expect ( "failed to run xargo" ) . success ( ) . not ( ) {
@@ -379,7 +379,7 @@ path = "lib.rs"
379
379
// That should be it! But we need to figure out where xargo built stuff.
380
380
// Unfortunately, it puts things into a different directory when the
381
381
// architecture matches the host.
382
- let is_host = match target. as_ref ( ) {
382
+ let is_host = match & target {
383
383
None => true ,
384
384
Some ( target) => target == & rustc_version:: version_meta ( ) . unwrap ( ) . host ,
385
385
} ;
@@ -404,12 +404,12 @@ fn main() {
404
404
return ;
405
405
}
406
406
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 ( ) {
408
408
// This arm is for when `cargo miri` is called. We call `cargo check` for each applicable target,
409
409
// but with the `RUSTC` env var set to the `cargo-miri` binary so that we come back in the other branch,
410
410
// and dispatch the invocations to `rustc` and `miri`, respectively.
411
411
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 ( ) {
413
413
// This arm is executed when `cargo-miri` runs `cargo check` with the `RUSTC_WRAPPER` env var set to itself:
414
414
// dependencies get dispatched to `rustc`, the final test/binary to `miri`.
415
415
inside_cargo_rustc ( ) ;
0 commit comments