@@ -501,16 +501,7 @@ impl<'a> Builder<'a> {
501
501
_ => return None ,
502
502
} ;
503
503
504
- let builder = Builder {
505
- build,
506
- top_stage : build. config . stage . unwrap_or ( 2 ) ,
507
- kind,
508
- cache : Cache :: new ( ) ,
509
- stack : RefCell :: new ( Vec :: new ( ) ) ,
510
- time_spent_on_dependencies : Cell :: new ( Duration :: new ( 0 , 0 ) ) ,
511
- paths : vec ! [ ] ,
512
- } ;
513
-
504
+ let builder = Self :: new_internal ( build, kind, vec ! [ ] ) ;
514
505
let builder = & builder;
515
506
let mut should_run = ShouldRun :: new ( builder) ;
516
507
for desc in Builder :: get_step_descriptions ( builder. kind ) {
@@ -535,6 +526,18 @@ impl<'a> Builder<'a> {
535
526
Some ( help)
536
527
}
537
528
529
+ fn new_internal ( build : & Build , kind : Kind , paths : Vec < PathBuf > ) -> Builder < ' _ > {
530
+ Builder {
531
+ build,
532
+ top_stage : build. config . stage . unwrap_or ( 2 ) ,
533
+ kind,
534
+ cache : Cache :: new ( ) ,
535
+ stack : RefCell :: new ( Vec :: new ( ) ) ,
536
+ time_spent_on_dependencies : Cell :: new ( Duration :: new ( 0 , 0 ) ) ,
537
+ paths,
538
+ }
539
+ }
540
+
538
541
pub fn new ( build : & Build ) -> Builder < ' _ > {
539
542
let ( kind, paths) = match build. config . cmd {
540
543
Subcommand :: Build { ref paths } => ( Kind :: Build , & paths[ ..] ) ,
@@ -550,15 +553,7 @@ impl<'a> Builder<'a> {
550
553
Subcommand :: Format { .. } | Subcommand :: Clean { .. } => panic ! ( ) ,
551
554
} ;
552
555
553
- Builder {
554
- build,
555
- top_stage : build. config . stage . unwrap_or ( 2 ) ,
556
- kind,
557
- cache : Cache :: new ( ) ,
558
- stack : RefCell :: new ( Vec :: new ( ) ) ,
559
- time_spent_on_dependencies : Cell :: new ( Duration :: new ( 0 , 0 ) ) ,
560
- paths : paths. to_owned ( ) ,
561
- }
556
+ Self :: new_internal ( build, kind, paths. to_owned ( ) )
562
557
}
563
558
564
559
pub fn execute_cli ( & self ) {
0 commit comments