Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/project-model/src/cargo_workspace.rs')
-rw-r--r--crates/project-model/src/cargo_workspace.rs39
1 files changed, 1 insertions, 38 deletions
diff --git a/crates/project-model/src/cargo_workspace.rs b/crates/project-model/src/cargo_workspace.rs
index e3fdeb448d..671760d4de 100644
--- a/crates/project-model/src/cargo_workspace.rs
+++ b/crates/project-model/src/cargo_workspace.rs
@@ -1,6 +1,5 @@
//! See [`CargoWorkspace`].
-use std::iter;
use std::path::PathBuf;
use std::str::from_utf8;
use std::{ops, process::Command};
@@ -58,20 +57,6 @@ pub enum RustLibSource {
Discover,
}
-/// Crates to disable `#[cfg(test)]` on.
-#[derive(Clone, Debug, PartialEq, Eq)]
-pub enum UnsetTestCrates {
- None,
- Only(Vec<String>),
- All,
-}
-
-impl Default for UnsetTestCrates {
- fn default() -> Self {
- Self::None
- }
-}
-
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum CargoFeatures {
All,
@@ -100,8 +85,7 @@ pub struct CargoConfig {
pub sysroot_src: Option<AbsPathBuf>,
/// rustc private crate source
pub rustc_source: Option<RustLibSource>,
- /// crates to disable `#[cfg(test)]` on
- pub unset_test_crates: UnsetTestCrates,
+ pub cfg_overrides: CfgOverrides,
/// Invoke `cargo check` through the RUSTC_WRAPPER.
pub wrap_rustc_in_build_scripts: bool,
/// The command to run instead of `cargo check` for building build scripts.
@@ -114,27 +98,6 @@ pub struct CargoConfig {
pub invocation_location: InvocationLocation,
}
-impl CargoConfig {
- pub fn cfg_overrides(&self) -> CfgOverrides {
- match &self.unset_test_crates {
- UnsetTestCrates::None => CfgOverrides::Selective(iter::empty().collect()),
- UnsetTestCrates::Only(unset_test_crates) => CfgOverrides::Selective(
- unset_test_crates
- .iter()
- .cloned()
- .zip(iter::repeat_with(|| {
- cfg::CfgDiff::new(Vec::new(), vec![cfg::CfgAtom::Flag("test".into())])
- .unwrap()
- }))
- .collect(),
- ),
- UnsetTestCrates::All => CfgOverrides::Wildcard(
- cfg::CfgDiff::new(Vec::new(), vec![cfg::CfgAtom::Flag("test".into())]).unwrap(),
- ),
- }
- }
-}
-
pub type Package = Idx<PackageData>;
pub type Target = Idx<TargetData>;