mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-25 11:14:46 +00:00
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`.
This commit is contained in:
parent
bef07b2de1
commit
5fb96e85bc
@ -11,8 +11,8 @@ use crate::core::dependency::DepKind;
|
||||
use crate::core::profiles::{Profiles, UnitFor};
|
||||
use crate::core::resolver::features::{self, FeaturesFor};
|
||||
use crate::core::resolver::{HasDevUnits, Resolve};
|
||||
use crate::core::Workspace;
|
||||
use crate::core::{FeatureValue, Package, PackageSet, Summary, Target};
|
||||
use crate::core::{TargetKind, Workspace};
|
||||
use crate::util::restricted_names::is_glob_pattern;
|
||||
use crate::util::{closest_msg, CargoResult};
|
||||
|
||||
@ -84,11 +84,6 @@ impl<'a> UnitGenerator<'a, '_> {
|
||||
CompileMode::Test
|
||||
}
|
||||
}
|
||||
CompileMode::Build => match *target.kind() {
|
||||
TargetKind::Test => CompileMode::Test,
|
||||
TargetKind::Bench => CompileMode::Test,
|
||||
_ => CompileMode::Build,
|
||||
},
|
||||
_ => initial_target_mode,
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user