@@ -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" )
@@ -248,12 +253,15 @@ To see all the flags the proxied tool accepts run `cargo-{} -- --help`.{}",
248
253
. help ( "Coloring: auto, always, never" ) ,
249
254
Arg :: new ( "frozen" )
250
255
. long ( "frozen" )
256
+ . action ( ArgAction :: SetTrue )
251
257
. help ( "Require Cargo.lock and cache are up to date" ) ,
252
258
Arg :: new ( "locked" )
253
259
. long ( "locked" )
260
+ . action ( ArgAction :: SetTrue )
254
261
. help ( "Require Cargo.lock is up to date" ) ,
255
262
Arg :: new ( "offline" )
256
263
. long ( "offline" )
264
+ . action ( ArgAction :: SetTrue )
257
265
. help ( "Run without accessing the network" ) ,
258
266
Arg :: new ( "unstable-features" )
259
267
. short ( 'Z' )
@@ -274,10 +282,10 @@ pub fn run(tool: Tool, matches: ArgMatches) -> Result<i32> {
274
282
features. map ( |s| s. to_owned ( ) ) . collect ( ) ,
275
283
) ) ;
276
284
}
277
- if matches. contains_id ( "no-default-features" ) {
285
+ if matches. get_flag ( "no-default-features" ) {
278
286
metadata_command. features ( CargoOpt :: NoDefaultFeatures ) ;
279
287
}
280
- if matches. contains_id ( "all-features" ) {
288
+ if matches. get_flag ( "all-features" ) {
281
289
metadata_command. features ( CargoOpt :: AllFeatures ) ;
282
290
}
283
291
let metadata = metadata_command. exec ( ) ?;
@@ -364,7 +372,7 @@ pub fn run(tool: Tool, matches: ArgMatches) -> Result<i32> {
364
372
// User flags
365
373
lltool. args ( & tool_args) ;
366
374
367
- if matches. contains_id ( "verbose" ) {
375
+ if matches. get_count ( "verbose" ) > 0 {
368
376
eprintln ! ( "{lltool:?}" ) ;
369
377
}
370
378
@@ -401,7 +409,7 @@ fn cargo_build(matches: &ArgMatches, metadata: &Metadata) -> Result<Option<Artif
401
409
cargo. arg ( "build" ) ;
402
410
403
411
let ( build_type, verbose) = cargo_build_args ( matches, & mut cargo) ;
404
- let quiet = matches. contains_id ( "quiet" ) ;
412
+ let quiet = matches. get_flag ( "quiet" ) ;
405
413
406
414
cargo. arg ( "--message-format=json" ) ;
407
415
cargo. stdout ( Stdio :: piped ( ) ) ;
@@ -454,7 +462,7 @@ fn cargo_build(matches: &ArgMatches, metadata: &Metadata) -> Result<Option<Artif
454
462
}
455
463
456
464
fn cargo_build_args < ' a > ( matches : & ' a ArgMatches , cargo : & mut Command ) -> ( BuildType < ' a > , u64 ) {
457
- if matches. contains_id ( "quiet" ) {
465
+ if matches. get_flag ( "quiet" ) {
458
466
cargo. arg ( "--quiet" ) ;
459
467
}
460
468
@@ -474,7 +482,7 @@ fn cargo_build_args<'a>(matches: &'a ArgMatches, cargo: &mut Command) -> (BuildT
474
482
cargo. arg ( jobs) ;
475
483
}
476
484
477
- let build_type = if matches. contains_id ( "lib" ) {
485
+ let build_type = if matches. get_flag ( "lib" ) {
478
486
cargo. args ( [ "--lib" ] ) ;
479
487
BuildType :: Lib
480
488
} else if let Some ( bin_name) = matches. get_one :: < String > ( "bin" ) {
@@ -493,7 +501,7 @@ fn cargo_build_args<'a>(matches: &'a ArgMatches, cargo: &mut Command) -> (BuildT
493
501
BuildType :: Any
494
502
} ;
495
503
496
- if matches. contains_id ( "release" ) {
504
+ if matches. get_flag ( "release" ) {
497
505
cargo. arg ( "--release" ) ;
498
506
}
499
507
@@ -507,10 +515,10 @@ fn cargo_build_args<'a>(matches: &'a ArgMatches, cargo: &mut Command) -> (BuildT
507
515
cargo. args ( [ "--features" , feature] ) ;
508
516
}
509
517
}
510
- if matches. contains_id ( "no-default-features" ) {
518
+ if matches. get_flag ( "no-default-features" ) {
511
519
cargo. arg ( "--no-default-features" ) ;
512
520
}
513
- if matches. contains_id ( "all-features" ) {
521
+ if matches. get_flag ( "all-features" ) {
514
522
cargo. arg ( "--all-features" ) ;
515
523
}
516
524
@@ -530,15 +538,15 @@ fn cargo_build_args<'a>(matches: &'a ArgMatches, cargo: &mut Command) -> (BuildT
530
538
cargo. arg ( color) ;
531
539
}
532
540
533
- if matches. contains_id ( "frozen" ) {
541
+ if matches. get_flag ( "frozen" ) {
534
542
cargo. arg ( "--frozen" ) ;
535
543
}
536
544
537
- if matches. contains_id ( "locked" ) {
545
+ if matches. get_flag ( "locked" ) {
538
546
cargo. arg ( "--locked" ) ;
539
547
}
540
548
541
- if matches. contains_id ( "offline" ) {
549
+ if matches. get_flag ( "offline" ) {
542
550
cargo. arg ( "--offline" ) ;
543
551
}
544
552
0 commit comments