Skip to content

Commit e241099

Browse files
committed
refactor: remove unreachable match arms for tests/benches
To justify why it won't affect any existing behavior: * For the default set of Cargo targets, test/bench targets would only be selected by `cargo test`, whose UserIntent will turn into `CompileMode::Test`, but never `CompileMode::Build`. * For selective Cargo targets, i.e., `--tests`, or `--test`, Their `CompileMode` would either be `Check { test }` or `Test`. They will never be `Build`. See https://github.com/rust-lang/cargo/blob/bffece899e9/src/cargo/ops/cargo_compile/unit_generator.rs#L450-L465 According to these facts, there won't be a case that bench/test targets get assigned to `CompileMode::Build`.
1 parent bef07b2 commit e241099

File tree

1 file changed

+0
-5
lines changed

1 file changed

+0
-5
lines changed

src/cargo/ops/cargo_compile/unit_generator.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,6 @@ impl<'a> UnitGenerator<'a, '_> {
8484
CompileMode::Test
8585
}
8686
}
87-
CompileMode::Build => match *target.kind() {
88-
TargetKind::Test => CompileMode::Test,
89-
TargetKind::Bench => CompileMode::Test,
90-
_ => CompileMode::Build,
91-
},
9287
_ => initial_target_mode,
9388
};
9489

0 commit comments

Comments
 (0)