@@ -241,7 +241,7 @@ fn normalize_args(args: &[String]) -> Vec<String> {
241
241
it. collect ( )
242
242
}
243
243
244
- #[ derive( Debug , Clone , Default , clap:: Subcommand ) ]
244
+ #[ derive( Debug , Clone , clap:: Subcommand ) ]
245
245
pub enum Subcommand {
246
246
#[ command( aliases = [ "b" ] , long_about = "\n
247
247
Arguments:
@@ -256,8 +256,11 @@ pub enum Subcommand {
256
256
./x.py build --stage 0
257
257
./x.py build " ) ]
258
258
/// Compile either the compiler or libraries
259
- #[ default]
260
- Build ,
259
+ Build {
260
+ #[ arg( long) ]
261
+ /// Pass `--timings` to Cargo to get crate build timings
262
+ timings : bool ,
263
+ } ,
261
264
#[ command( aliases = [ "c" ] , long_about = "\n
262
265
Arguments:
263
266
This subcommand accepts a number of paths to directories to the crates
@@ -269,6 +272,9 @@ pub enum Subcommand {
269
272
#[ arg( long) ]
270
273
/// Check all targets
271
274
all_targets : bool ,
275
+ #[ arg( long) ]
276
+ /// Pass `--timings` to Cargo to get crate build timings
277
+ timings : bool ,
272
278
} ,
273
279
/// Run Clippy (uses rustup/cargo-installed clippy binary)
274
280
#[ command( long_about = "\n
@@ -494,11 +500,17 @@ Arguments:
494
500
Perf ( PerfArgs ) ,
495
501
}
496
502
503
+ impl Default for Subcommand {
504
+ fn default ( ) -> Self {
505
+ Subcommand :: Build { timings : false }
506
+ }
507
+ }
508
+
497
509
impl Subcommand {
498
510
pub fn kind ( & self ) -> Kind {
499
511
match self {
500
512
Subcommand :: Bench { .. } => Kind :: Bench ,
501
- Subcommand :: Build => Kind :: Build ,
513
+ Subcommand :: Build { .. } => Kind :: Build ,
502
514
Subcommand :: Check { .. } => Kind :: Check ,
503
515
Subcommand :: Clippy { .. } => Kind :: Clippy ,
504
516
Subcommand :: Doc { .. } => Kind :: Doc ,
@@ -626,6 +638,13 @@ impl Subcommand {
626
638
}
627
639
}
628
640
641
+ pub fn timings ( & self ) -> bool {
642
+ match * self {
643
+ Subcommand :: Build { timings, .. } | Subcommand :: Check { timings, .. } => timings,
644
+ _ => false ,
645
+ }
646
+ }
647
+
629
648
pub fn vendor_versioned_dirs ( & self ) -> bool {
630
649
match * self {
631
650
Subcommand :: Vendor { versioned_dirs, .. } => versioned_dirs,
0 commit comments