@@ -86,18 +86,9 @@ impl<'a> UnitGenerator<'a, '_> {
86
86
}
87
87
CompileMode :: Build => match * target. kind ( ) {
88
88
TargetKind :: Test => CompileMode :: Test ,
89
- TargetKind :: Bench => CompileMode :: Bench ,
89
+ TargetKind :: Bench => CompileMode :: Test ,
90
90
_ => CompileMode :: Build ,
91
91
} ,
92
- // `CompileMode::Bench` is only used to inform `filter_default_targets`
93
- // which command is being used (`cargo bench`). Afterwards, tests
94
- // and benches are treated identically. Switching the mode allows
95
- // de-duplication of units that are essentially identical. For
96
- // example, `cargo build --all-targets --release` creates the units
97
- // (lib profile:bench, mode:test) and (lib profile:bench, mode:bench)
98
- // and since these are the same, we want them to be de-duplicated in
99
- // `unit_dependencies`.
100
- CompileMode :: Bench => CompileMode :: Test ,
101
92
_ => initial_target_mode,
102
93
} ;
103
94
@@ -476,11 +467,6 @@ impl<'a> UnitGenerator<'a, '_> {
476
467
FilterRule :: All => Target :: benched,
477
468
FilterRule :: Just ( _) => Target :: is_bench,
478
469
} ;
479
- let bench_mode = match self . intent {
480
- UserIntent :: Build => CompileMode :: Bench ,
481
- UserIntent :: Check { .. } => CompileMode :: Check { test : true } ,
482
- _ => default_mode,
483
- } ;
484
470
485
471
proposals. extend ( self . list_rule_targets (
486
472
bins,
@@ -499,7 +485,7 @@ impl<'a> UnitGenerator<'a, '_> {
499
485
benches,
500
486
"bench" ,
501
487
bench_filter,
502
- bench_mode ,
488
+ test_mode ,
503
489
) ?) ;
504
490
}
505
491
}
@@ -792,8 +778,7 @@ Rustdoc did not scrape the following examples because they require dev-dependenc
792
778
/// Converts [`UserIntent`] to [`CompileMode`] for root units.
793
779
fn to_compile_mode ( intent : UserIntent ) -> CompileMode {
794
780
match intent {
795
- UserIntent :: Test => CompileMode :: Test ,
796
- UserIntent :: Bench => CompileMode :: Bench ,
781
+ UserIntent :: Test | UserIntent :: Bench => CompileMode :: Test ,
797
782
UserIntent :: Build => CompileMode :: Build ,
798
783
UserIntent :: Check { test } => CompileMode :: Check { test } ,
799
784
UserIntent :: Doc { deps, json } => CompileMode :: Doc { deps, json } ,
0 commit comments