@@ -178,6 +178,7 @@ To see all the flags the proxied tool accepts run `cargo-{} -- --help`.{}",
178
178
Arg :: new ( "quiet" )
179
179
. long ( "quiet" )
180
180
. short ( 'q' )
181
+ . action ( ArgAction :: SetTrue )
181
182
. help ( "Don't print build output from `cargo build`" ) ,
182
183
Arg :: new ( "package" )
183
184
. long ( "package" )
@@ -191,6 +192,7 @@ To see all the flags the proxied tool accepts run `cargo-{} -- --help`.{}",
191
192
. help ( "Number of parallel jobs, defaults to # of CPUs" ) ,
192
193
Arg :: new ( "lib" )
193
194
. long ( "lib" )
195
+ . action ( ArgAction :: SetTrue )
194
196
. conflicts_with_all ( [ "bin" , "example" , "test" , "bench" ] )
195
197
. help ( "Build only this package's library" ) ,
196
198
Arg :: new ( "bin" )
@@ -215,6 +217,7 @@ To see all the flags the proxied tool accepts run `cargo-{} -- --help`.{}",
215
217
. help ( "Build only the specified bench target" ) ,
216
218
Arg :: new ( "release" )
217
219
. long ( "release" )
220
+ . action ( ArgAction :: SetTrue )
218
221
. help ( "Build artifacts in release mode, with optimizations" ) ,
219
222
Arg :: new ( "profile" )
220
223
. long ( "profile" )
@@ -227,9 +230,11 @@ To see all the flags the proxied tool accepts run `cargo-{} -- --help`.{}",
227
230
. help ( "Space-separated list of features to activate" ) ,
228
231
Arg :: new ( "all-features" )
229
232
. long ( "all-features" )
233
+ . action ( ArgAction :: SetTrue )
230
234
. help ( "Activate all available features" ) ,
231
235
Arg :: new ( "no-default-features" )
232
236
. long ( "no-default-features" )
237
+ . action ( ArgAction :: SetTrue )
233
238
. help ( "Do not activate the `default` feature" ) ,
234
239
Arg :: new ( "target" )
235
240
. long ( "target" )
@@ -244,12 +249,15 @@ To see all the flags the proxied tool accepts run `cargo-{} -- --help`.{}",
244
249
. help ( "Coloring: auto, always, never" ) ,
245
250
Arg :: new ( "frozen" )
246
251
. long ( "frozen" )
252
+ . action ( ArgAction :: SetTrue )
247
253
. help ( "Require Cargo.lock and cache are up to date" ) ,
248
254
Arg :: new ( "locked" )
249
255
. long ( "locked" )
256
+ . action ( ArgAction :: SetTrue )
250
257
. help ( "Require Cargo.lock is up to date" ) ,
251
258
Arg :: new ( "offline" )
252
259
. long ( "offline" )
260
+ . action ( ArgAction :: SetTrue )
253
261
. help ( "Run without accessing the network" ) ,
254
262
Arg :: new ( "unstable-features" )
255
263
. short ( 'Z' )
@@ -270,10 +278,10 @@ pub fn run(tool: Tool, matches: ArgMatches) -> Result<i32> {
270
278
features. map ( |s| s. to_owned ( ) ) . collect ( ) ,
271
279
) ) ;
272
280
}
273
- if matches. contains_id ( "no-default-features" ) {
281
+ if matches. get_flag ( "no-default-features" ) {
274
282
metadata_command. features ( CargoOpt :: NoDefaultFeatures ) ;
275
283
}
276
- if matches. contains_id ( "all-features" ) {
284
+ if matches. get_flag ( "all-features" ) {
277
285
metadata_command. features ( CargoOpt :: AllFeatures ) ;
278
286
}
279
287
let metadata = metadata_command. exec ( ) ?;
@@ -360,7 +368,7 @@ pub fn run(tool: Tool, matches: ArgMatches) -> Result<i32> {
360
368
// User flags
361
369
lltool. args ( & tool_args) ;
362
370
363
- if matches. contains_id ( "verbose" ) {
371
+ if matches. get_flag ( "verbose" ) {
364
372
eprintln ! ( "{lltool:?}" ) ;
365
373
}
366
374
@@ -397,7 +405,7 @@ fn cargo_build(matches: &ArgMatches, metadata: &Metadata) -> Result<Option<Artif
397
405
cargo. arg ( "build" ) ;
398
406
399
407
let ( build_type, verbose) = cargo_build_args ( matches, & mut cargo) ;
400
- let quiet = matches. contains_id ( "quiet" ) ;
408
+ let quiet = matches. get_flag ( "quiet" ) ;
401
409
402
410
cargo. arg ( "--message-format=json" ) ;
403
411
cargo. stdout ( Stdio :: piped ( ) ) ;
@@ -450,7 +458,7 @@ fn cargo_build(matches: &ArgMatches, metadata: &Metadata) -> Result<Option<Artif
450
458
}
451
459
452
460
fn cargo_build_args < ' a > ( matches : & ' a ArgMatches , cargo : & mut Command ) -> ( BuildType < ' a > , u64 ) {
453
- if matches. contains_id ( "quiet" ) {
461
+ if matches. get_flag ( "quiet" ) {
454
462
cargo. arg ( "--quiet" ) ;
455
463
}
456
464
@@ -464,7 +472,7 @@ fn cargo_build_args<'a>(matches: &'a ArgMatches, cargo: &mut Command) -> (BuildT
464
472
cargo. arg ( jobs) ;
465
473
}
466
474
467
- let build_type = if matches. contains_id ( "lib" ) {
475
+ let build_type = if matches. get_flag ( "lib" ) {
468
476
cargo. args ( [ "--lib" ] ) ;
469
477
BuildType :: Lib
470
478
} else if let Some ( bin_name) = matches. get_one :: < String > ( "bin" ) {
@@ -483,7 +491,7 @@ fn cargo_build_args<'a>(matches: &'a ArgMatches, cargo: &mut Command) -> (BuildT
483
491
BuildType :: Any
484
492
} ;
485
493
486
- if matches. contains_id ( "release" ) {
494
+ if matches. get_flag ( "release" ) {
487
495
cargo. arg ( "--release" ) ;
488
496
}
489
497
@@ -497,10 +505,10 @@ fn cargo_build_args<'a>(matches: &'a ArgMatches, cargo: &mut Command) -> (BuildT
497
505
cargo. args ( [ "--features" , feature] ) ;
498
506
}
499
507
}
500
- if matches. contains_id ( "no-default-features" ) {
508
+ if matches. get_flag ( "no-default-features" ) {
501
509
cargo. arg ( "--no-default-features" ) ;
502
510
}
503
- if matches. contains_id ( "all-features" ) {
511
+ if matches. get_flag ( "all-features" ) {
504
512
cargo. arg ( "--all-features" ) ;
505
513
}
506
514
@@ -520,15 +528,15 @@ fn cargo_build_args<'a>(matches: &'a ArgMatches, cargo: &mut Command) -> (BuildT
520
528
cargo. arg ( color) ;
521
529
}
522
530
523
- if matches. contains_id ( "frozen" ) {
531
+ if matches. get_flag ( "frozen" ) {
524
532
cargo. arg ( "--frozen" ) ;
525
533
}
526
534
527
- if matches. contains_id ( "locked" ) {
535
+ if matches. get_flag ( "locked" ) {
528
536
cargo. arg ( "--locked" ) ;
529
537
}
530
538
531
- if matches. contains_id ( "offline" ) {
539
+ if matches. get_flag ( "offline" ) {
532
540
cargo. arg ( "--offline" ) ;
533
541
}
534
542
0 commit comments