diff --git a/src/cargo/ops/cargo_compile.rs b/src/cargo/ops/cargo_compile.rs index 2aabb150b49..bd89fcc3454 100644 --- a/src/cargo/ops/cargo_compile.rs +++ b/src/cargo/ops/cargo_compile.rs @@ -652,14 +652,6 @@ fn generate_targets<'a>(pkg: &'a Package, pkg, bins, "bin", Target::is_bin, profile)?); targets.append(&mut propose_indicated_targets( pkg, examples, "example", Target::is_example, profile)?); - // If --benches was specified, add all targets that would be - // generated by `cargo bench`. - let bench_filter = match benches { - FilterRule::All => Target::benched, - FilterRule::Just(_) => Target::is_bench - }; - targets.append(&mut propose_indicated_targets( - pkg, benches, "bench", bench_filter, bench_profile)?); // If --tests was specified, add all targets that would be // generated by `cargo test`. let test_filter = match tests { @@ -668,6 +660,14 @@ fn generate_targets<'a>(pkg: &'a Package, }; targets.append(&mut propose_indicated_targets( pkg, tests, "test", test_filter, test_profile)?); + // If --benches was specified, add all targets that would be + // generated by `cargo bench`. + let bench_filter = match benches { + FilterRule::All => Target::benched, + FilterRule::Just(_) => Target::is_bench + }; + targets.append(&mut propose_indicated_targets( + pkg, benches, "bench", bench_filter, bench_profile)?); targets } };