Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Remove unused features from dependencies (#64826)
Kirill Bulatov4c841aaf1c4f
diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.ymlindex 3babc1e5c87..0ec33cb5cd3 100644--- a/.github/workflows/run_tests.yml+++ b/.github/workflows/run_tests.yml@@ -616,6 +616,8 @@ jobs:run: cargo build -p collab- name: cargo build --workspace --bins --examplesrun: cargo build --workspace --bins --examples+ - name: cargo build -p project_benchmarks --features test-support+ run: cargo build -p project_benchmarks --features test-support- name: steps::show_sccache_statsrun: sccache --show-stats || true- name: steps::cleanup_cargo_configdiff --git a/Cargo.lock b/Cargo.lockindex 4eb6561afa1..1ed2119bc9e 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -20645,7 +20645,6 @@ dependencies = ["url","wasmtime","wasmtime-wasi-io",- "wiggle","windows-sys 0.61.2",]@@ -20662,15 +20661,6 @@ dependencies = ["wasmtime",]-[[package]]-name = "wast"-version = "35.0.2"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "2ef140f1b49946586078353a453a1d28ba90adfc54dde75710bc1931de204d68"-dependencies = [- "leb128",-]-[[package]]name = "watch"version = "0.1.0"@@ -21132,46 +21122,6 @@ dependencies = ["wasite",]-[[package]]-name = "wiggle"-version = "48.0.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "b871ea219ad85c1e59ee7d013563814e86d2e6aa094d3bc66b7675ec4ca58bb7"-dependencies = [- "bitflags 2.13.1",- "thiserror 2.0.17",- "tracing",- "wasmtime",- "wasmtime-environ",- "wiggle-macro",-]--[[package]]-name = "wiggle-generate"-version = "48.0.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "ed981675756e748a4725286a4059c9be006749a8db4120d54e2021d0f167bac3"-dependencies = [- "heck 0.5.0",- "proc-macro2",- "quote",- "syn 2.0.117",- "wasmtime-environ",- "witx",-]--[[package]]-name = "wiggle-macro"-version = "48.0.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "7f3927729af874585c58b85710128e40d459a7064bb9aea9b0b420fb5eafd555"-dependencies = [- "proc-macro2",- "quote",- "syn 2.0.117",- "wiggle-generate",-]-[[package]]name = "winapi"version = "0.3.9"@@ -22332,18 +22282,6 @@ dependencies = ["wasmparser 0.254.0",]-[[package]]-name = "witx"-version = "0.9.1"-source = "registry+https://github.com/rust-lang/crates.io-index"-checksum = "e366f27a5cabcddb2706a78296a40b8fcc451e1a6aba2fc1d94b4a01bdaaef4b"-dependencies = [- "anyhow",- "log",- "thiserror 1.0.69",- "wast",-]-[[package]]name = "workspace"version = "0.1.0"diff --git a/Cargo.toml b/Cargo.tomlindex d1591366ed1..0e5908bbe45 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -552,13 +552,17 @@ async-task = "4.7"async-trait = "0.1"async-tungstenite = "0.33"async_zip = { version = "0.0.18", features = ["deflate", "deflate64"] }-aws-config = { version = "1.8.10", features = ["behavior-version-latest"] }+aws-config = { version = "1.8.10", default-features = false, features = [+ "behavior-version-latest",+ "credentials-process",+ "rt-tokio",+ "sso",+] }aws-credential-types = { version = "1.2.8", features = ["hardcoded-credentials",] }aws-sdk-bedrockruntime = { version = "1.112.0", default-features = false, features = ["behavior-version-latest",- "default-https-client","rt-tokio",] }aws-sigv4 = { version = "1.4.0", features = ["http1"] }@@ -922,7 +926,7 @@ wasmtime = { version = "48", default-features = false, features = [] }wasm-bindgen = "0.2.120"wasm-bindgen-futures = "0.4"-wasmtime-wasi = "48"+wasmtime-wasi = { version = "48", default-features = false, features = ["p2"] }wax = "0.7"web-time = "1.1.0"webpki-roots = "1.0.8"diff --git a/crates/context_server/Cargo.toml b/crates/context_server/Cargo.tomlindex 01141ce862d..3ed8c341c1b 100644--- a/crates/context_server/Cargo.toml+++ b/crates/context_server/Cargo.toml@@ -24,7 +24,7 @@ collections.workspace = truefutures.workspace = truefutures-lite.workspace = truegpui.workspace = true-http_client = { workspace = true, features = ["test-support"] }+http_client.workspace = truelog.workspace = truenet.workspace = trueoauth_callback_server.workspace = true@@ -43,3 +43,4 @@ util.workspace = true[dev-dependencies]gpui = { workspace = true, features = ["test-support"] }+http_client = { workspace = true, features = ["test-support"] }diff --git a/crates/livekit_client/Cargo.toml b/crates/livekit_client/Cargo.tomlindex 72d717730ac..34feb6f9356 100644--- a/crates/livekit_client/Cargo.toml+++ b/crates/livekit_client/Cargo.toml@@ -30,7 +30,7 @@ gpui = { workspace = true, features = ["screen-capture", "x11", "wayland"] }gpui_tokio.workspace = truehttp_client_tls.workspace = trueimage.workspace = true-livekit_api.workspace = true+livekit_api = { workspace = true, optional = true }log.workspace = truenanoid.workspace = trueparking_lot.workspace = true@@ -43,6 +43,9 @@ smallvec.workspace = trueui.workspace = trueutil.workspace = true+[target.'cfg(any(all(target_os = "windows", target_env = "gnu"), target_os = "freebsd"))'.dependencies]+livekit_api.workspace = true+[target.'cfg(not(any(all(target_os = "windows", target_env = "gnu"), target_os = "freebsd")))'.dependencies]libwebrtc.workspace = truelivekit.workspace = truediff --git a/crates/project_benchmarks/Cargo.toml b/crates/project_benchmarks/Cargo.tomlindex e449bdb889f..e5ad504f761 100644--- a/crates/project_benchmarks/Cargo.toml+++ b/crates/project_benchmarks/Cargo.toml@@ -4,6 +4,14 @@ version = "0.1.0"publish.workspace = trueedition.workspace = true+[features]+test-support = ["http_client/test-support"]++[[bin]]+name = "project_benchmarks"+path = "src/main.rs"+required-features = ["test-support"]+[dependencies]anyhow.workspace = trueaskpass.workspace = true@@ -12,7 +20,7 @@ client.workspace = truefutures.workspace = truegpui.workspace = truegpui_platform.workspace = true-http_client = { workspace = true, features = ["test-support"]}+http_client.workspace = truelanguage.workspace = truenode_runtime.workspace = trueproject.workspace = truediff --git a/tooling/xtask/src/tasks/workflows/run_tests.rs b/tooling/xtask/src/tasks/workflows/run_tests.rsindex 8b7c7d5a04e..87e8152f231 100644--- a/tooling/xtask/src/tasks/workflows/run_tests.rs+++ b/tooling/xtask/src/tasks/workflows/run_tests.rs@@ -613,6 +613,9 @@ fn check_workspace_binaries() -> NamedJob {.add_step(steps::setup_sccache(Platform::Linux)).add_step(steps::script("cargo build -p collab")).add_step(steps::script("cargo build --workspace --bins --examples"))+ .add_step(steps::script(+ "cargo build -p project_benchmarks --features test-support",+ )).add_step(steps::show_sccache_stats(Platform::Linux)).add_step(steps::cleanup_cargo_config(Platform::Linux)),))diff --git a/tooling/xtask/src/workspace.rs b/tooling/xtask/src/workspace.rsindex e7a28c45a30..b0ec9d9b596 100644--- a/tooling/xtask/src/workspace.rs+++ b/tooling/xtask/src/workspace.rs@@ -66,6 +66,46 @@ mod tests {);}+ #[test]+ fn no_test_support_in_non_dev_dependencies() {+ let workspace = load_workspace().expect("failed to load cargo metadata");+ let mut violations = Vec::new();++ for package in workspace.workspace_packages() {+ for dependency in &package.dependencies {+ if dependency.kind == DependencyKind::Development+ || !dependency+ .features+ .iter()+ .any(|feature| feature == "test-support")+ {+ continue;+ }++ let manifest = package+ .manifest_path+ .strip_prefix(&workspace.workspace_root)+ .unwrap_or(&package.manifest_path);+ let name = dependency.rename.as_deref().unwrap_or(&dependency.name);+ let target = dependency+ .target+ .as_ref()+ .map(|target| format!(" for {target}"))+ .unwrap_or_default();+ violations.push(format!(+ "{manifest}: `{name}` enables `test-support` in {:?} dependencies{target}",+ dependency.kind,+ ));+ }+ }++ assert!(+ violations.is_empty(),+ "non-dev dependencies must not enable `test-support`; \+ use dev-dependencies or explicit feature forwarding instead:\n{violations:?}",+ );+ }+#[test]fn no_forbidden_dependencies_between_feature_crates() {let workspace = load_workspace().expect("failed to load cargo metadata");