From e5ffd02ff2b325fd139fd8e8551c9f43115969eb Mon Sep 17 00:00:00 2001 From: Tim Diekmann Date: Mon, 6 Jul 2026 16:00:04 +0200 Subject: [PATCH 1/5] BE-640: Fix cargo unused_dependencies warnings and surface them in CI --- .github/workflows/lint.yml | 8 ++++++++ Cargo.lock | 7 ------- apps/hash-graph/src/main.rs | 2 +- libs/@blockprotocol/type-system/rust/Cargo.toml | 1 - libs/@blockprotocol/type-system/rust/src/lib.rs | 2 +- libs/@local/codec/src/lib.rs | 2 +- libs/@local/codegen/src/lib.rs | 2 +- libs/@local/effect-dns/hickory/src/lib.rs | 2 +- libs/@local/graph/api/Cargo.toml | 1 - libs/@local/graph/api/src/lib.rs | 2 +- libs/@local/graph/authorization/Cargo.toml | 3 --- libs/@local/graph/authorization/src/lib.rs | 2 +- libs/@local/graph/migrations-macros/src/lib.rs | 2 +- libs/@local/graph/migrations/src/lib.rs | 2 +- libs/@local/graph/postgres-store/src/lib.rs | 2 +- libs/@local/graph/store/src/lib.rs | 2 +- libs/@local/graph/temporal-versioning/src/lib.rs | 2 +- libs/@local/graph/type-defs/src/lib.rs | 2 +- libs/@local/graph/type-fetcher/Cargo.toml | 2 +- libs/@local/graph/type-fetcher/src/lib.rs | 2 +- libs/@local/graph/types/src/lib.rs | 2 +- libs/@local/graph/validation/src/lib.rs | 2 +- libs/@local/harpc/client/rust/src/lib.rs | 2 +- libs/@local/harpc/codec/src/lib.rs | 2 +- libs/@local/harpc/net/src/lib.rs | 2 +- libs/@local/harpc/server/src/lib.rs | 2 +- libs/@local/harpc/system/src/lib.rs | 2 +- libs/@local/harpc/tower/src/lib.rs | 2 +- libs/@local/harpc/types/src/lib.rs | 2 +- libs/@local/harpc/wire-protocol/src/lib.rs | 2 +- libs/@local/hashql/ast/src/lib.rs | 2 +- libs/@local/hashql/compiletest/src/lib.rs | 2 +- libs/@local/hashql/compiletest/src/main.rs | 2 +- libs/@local/hashql/core/Cargo.toml | 1 - libs/@local/hashql/core/src/lib.rs | 2 +- libs/@local/hashql/diagnostics/Cargo.toml | 1 - libs/@local/hashql/diagnostics/src/lib.rs | 2 +- libs/@local/hashql/eval/src/lib.rs | 2 +- libs/@local/hashql/hir/src/lib.rs | 2 +- libs/@local/hashql/mir/src/lib.rs | 2 +- libs/@local/hashql/syntax-jexpr/src/lib.rs | 2 +- libs/@local/repo-chores/rust/src/lib.rs | 2 +- libs/@local/status/rust/src/lib.rs | 2 +- libs/@local/telemetry/Cargo.toml | 4 ++-- libs/@local/telemetry/src/lib.rs | 2 +- libs/@local/temporal-client/src/lib.rs | 2 +- libs/error-stack/src/fmt/hook.rs | 4 ++++ tests/graph/test-data/rust/src/lib.rs | 2 +- 48 files changed, 53 insertions(+), 55 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 5deee6bf03d..8884ea1f76e 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -139,6 +139,7 @@ jobs: run: | pushd ${{ matrix.path }} turbo run lint:clippy --filter "${{ matrix.name }}" -- --message-format=json \ + | tee clippy-output.log \ | clippy-sarif \ | jq --arg path "${{ matrix.path }}" '.runs[].results |= map(select(.locations[].physicalLocation.artifactLocation.uri | startswith($path)))' \ | jq '.runs[].results |= unique' \ @@ -148,6 +149,13 @@ jobs: jq -e '.runs[].results == []' ${{ matrix.path }}/clippy.sarif> /dev/null + # Cargo's manifest lints (e.g. `cargo::unused_dependencies`) are emitted as plain text + # rather than compiler JSON messages, so they bypass the SARIF gate above. + if grep -E "warning: unused dependency|\(manifest\) generated" ${{ matrix.path }}/clippy-output.log; then + echo 'Cargo reported manifest lint warnings; see the lines above.' + exit 1 + fi + - name: Print clippy errors to summary if: failure() && steps.lints.outputs.clippy == 'true' run: | diff --git a/Cargo.lock b/Cargo.lock index 2ff543d2245..61ffd548374 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3585,7 +3585,6 @@ dependencies = [ "mime", "opentelemetry 0.32.0", "opentelemetry-semantic-conventions 0.32.1", - "opentelemetry_sdk 0.32.1", "reqwest", "sentry", "serde", @@ -3613,15 +3612,12 @@ dependencies = [ "derive_more", "enum-iterator", "error-stack", - "futures", - "futures-core", "hash-codec", "hash-codegen", "indoc", "insta", "postgres-types", "pretty_assertions", - "reqwest", "serde", "serde_json", "serde_plain", @@ -4142,7 +4138,6 @@ dependencies = [ "proptest", "rapidfuzz", "roaring", - "rpds", "rstest", "serde", "simple-mermaid", @@ -4163,7 +4158,6 @@ dependencies = [ "anstyle", "anstyle-lossy", "anstyle-svg", - "derive_more", "rstest", "serde", "serde_core", @@ -10565,7 +10559,6 @@ dependencies = [ "derive_more", "email_address", "error-stack", - "futures", "hash-codec", "hash-codegen", "hash-graph-temporal-versioning", diff --git a/apps/hash-graph/src/main.rs b/apps/hash-graph/src/main.rs index e8ac0681ffc..1c2967c41d4 100644 --- a/apps/hash-graph/src/main.rs +++ b/apps/hash-graph/src/main.rs @@ -1,7 +1,7 @@ //! # HASH Graph //! //! ## Workspace dependencies -#![cfg_attr(doc, doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd"))] +#![doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd")] #![forbid(unsafe_code)] #![expect( unreachable_pub, diff --git a/libs/@blockprotocol/type-system/rust/Cargo.toml b/libs/@blockprotocol/type-system/rust/Cargo.toml index 467f9de2c09..491f0a779fa 100644 --- a/libs/@blockprotocol/type-system/rust/Cargo.toml +++ b/libs/@blockprotocol/type-system/rust/Cargo.toml @@ -35,7 +35,6 @@ uuid = { workspace = true, public = true, features = ["v5", "serde", # Private third-party dependencies derive_more = { workspace = true, features = ["display", "error", "from"] } -futures = { workspace = true } itertools = { workspace = true, features = ["use_alloc"] } regex = { workspace = true, features = ["std"] } serde = { workspace = true, features = ["derive", "rc"] } diff --git a/libs/@blockprotocol/type-system/rust/src/lib.rs b/libs/@blockprotocol/type-system/rust/src/lib.rs index 087a29676ef..6b655e8bbc2 100644 --- a/libs/@blockprotocol/type-system/rust/src/lib.rs +++ b/libs/@blockprotocol/type-system/rust/src/lib.rs @@ -336,7 +336,7 @@ //! - `utoipa` - Enables OpenAPI schema generation //! //! ## Workspace dependencies -#![cfg_attr(doc, doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd"))] +#![doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd")] extern crate alloc; diff --git a/libs/@local/codec/src/lib.rs b/libs/@local/codec/src/lib.rs index 633d7739703..f30f9e2470b 100644 --- a/libs/@local/codec/src/lib.rs +++ b/libs/@local/codec/src/lib.rs @@ -1,7 +1,7 @@ #![cfg_attr(doc, doc = include_str!("../README.md"))] //! //! ## Workspace dependencies -#![cfg_attr(doc, doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd"))] +#![doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd")] extern crate alloc; diff --git a/libs/@local/codegen/src/lib.rs b/libs/@local/codegen/src/lib.rs index a2ff2bc5598..564aa500b54 100644 --- a/libs/@local/codegen/src/lib.rs +++ b/libs/@local/codegen/src/lib.rs @@ -3,7 +3,7 @@ //! Code generation utilities for the HASH ecosystem. //! //! ## Workspace dependencies -#![cfg_attr(doc, doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd"))] +#![doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd")] #![expect(clippy::todo)] use alloc::{borrow::Cow, collections::BTreeSet}; diff --git a/libs/@local/effect-dns/hickory/src/lib.rs b/libs/@local/effect-dns/hickory/src/lib.rs index ca8a09ea587..6fdba715163 100644 --- a/libs/@local/effect-dns/hickory/src/lib.rs +++ b/libs/@local/effect-dns/hickory/src/lib.rs @@ -1,7 +1,7 @@ //! # Effect-DNS Hickory //! //! ## Workspace dependencies -#![cfg_attr(doc, doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd"))] +#![doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd")] #![allow(clippy::cfg_not_test, reason = "napi macro uses cfg(not(test))")] use napi_derive::napi; diff --git a/libs/@local/graph/api/Cargo.toml b/libs/@local/graph/api/Cargo.toml index 5589b893052..9a428f7be6a 100644 --- a/libs/@local/graph/api/Cargo.toml +++ b/libs/@local/graph/api/Cargo.toml @@ -67,7 +67,6 @@ md-5 = { workspace = true } mime = { workspace = true } opentelemetry = { workspace = true } opentelemetry-semantic-conventions = { workspace = true, features = ["semconv_experimental"] } -opentelemetry_sdk = { workspace = true, features = ["rt-tokio"] } reqwest = { workspace = true } sentry = { workspace = true } serde = { workspace = true, features = ['derive'] } diff --git a/libs/@local/graph/api/src/lib.rs b/libs/@local/graph/api/src/lib.rs index 6eced828a20..6d6aa235943 100644 --- a/libs/@local/graph/api/src/lib.rs +++ b/libs/@local/graph/api/src/lib.rs @@ -1,6 +1,6 @@ #![cfg_attr(doc, doc = include_str!("../README.md"))] //! ## Workspace dependencies -#![cfg_attr(doc, doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd"))] +#![doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd")] #![feature( // Language Features impl_trait_in_assoc_type, diff --git a/libs/@local/graph/authorization/Cargo.toml b/libs/@local/graph/authorization/Cargo.toml index 6ebac540c4c..a2ca133044a 100644 --- a/libs/@local/graph/authorization/Cargo.toml +++ b/libs/@local/graph/authorization/Cargo.toml @@ -12,9 +12,7 @@ error-stack = { workspace = true, public = true, features = ["unstable"] } type-system = { workspace = true, public = true } # Public third-party dependencies -futures-core = { workspace = true, public = true } postgres-types = { workspace = true, public = true, features = ["derive", "with-uuid-1"], optional = true } -reqwest = { workspace = true, public = true, features = ["json", "stream"] } specta = { workspace = true, public = true, optional = true, features = ["derive"] } # Private workspace dependencies @@ -26,7 +24,6 @@ cedar-policy-core = { workspace = true } derive-where = { workspace = true } derive_more = { workspace = true, features = ["display", "error", "from"] } enum-iterator = { workspace = true } -futures = { workspace = true } serde = { workspace = true, features = ["derive", "unstable"] } serde_json = { workspace = true } serde_plain = { workspace = true } diff --git a/libs/@local/graph/authorization/src/lib.rs b/libs/@local/graph/authorization/src/lib.rs index 208fe8f49fa..04193eaa15c 100644 --- a/libs/@local/graph/authorization/src/lib.rs +++ b/libs/@local/graph/authorization/src/lib.rs @@ -1,7 +1,7 @@ //! # HASH Graph Authorization //! //! ## Workspace dependencies -#![cfg_attr(doc, doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd"))] +#![doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd")] #![feature( // Language Features exhaustive_patterns, diff --git a/libs/@local/graph/migrations-macros/src/lib.rs b/libs/@local/graph/migrations-macros/src/lib.rs index 8ac62e4b748..dd53bd4daee 100644 --- a/libs/@local/graph/migrations-macros/src/lib.rs +++ b/libs/@local/graph/migrations-macros/src/lib.rs @@ -1,6 +1,6 @@ //! //! ## Workspace dependencies -#![cfg_attr(doc, doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd"))] +#![doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd")] extern crate alloc; diff --git a/libs/@local/graph/migrations/src/lib.rs b/libs/@local/graph/migrations/src/lib.rs index df8c7fcc435..ea45685a750 100644 --- a/libs/@local/graph/migrations/src/lib.rs +++ b/libs/@local/graph/migrations/src/lib.rs @@ -1,7 +1,7 @@ //! # HASH Graph Migrations //! //! ## Workspace dependencies -#![cfg_attr(doc, doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd"))] +#![doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd")] #![feature( // Language Features impl_trait_in_assoc_type, diff --git a/libs/@local/graph/postgres-store/src/lib.rs b/libs/@local/graph/postgres-store/src/lib.rs index 4fc05125e87..4260e7d2275 100644 --- a/libs/@local/graph/postgres-store/src/lib.rs +++ b/libs/@local/graph/postgres-store/src/lib.rs @@ -1,7 +1,7 @@ //! The entity-graph query-layer for the HASH datastore. //! //! ## Workspace dependencies -#![cfg_attr(doc, doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd"))] +#![doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd")] #![feature( // Language Features impl_trait_in_assoc_type, diff --git a/libs/@local/graph/store/src/lib.rs b/libs/@local/graph/store/src/lib.rs index 2931d3f0eca..d1459632ef0 100644 --- a/libs/@local/graph/store/src/lib.rs +++ b/libs/@local/graph/store/src/lib.rs @@ -1,7 +1,7 @@ //! # HASH Graph Store //! //! ## Workspace dependencies -#![cfg_attr(doc, doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd"))] +#![doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd")] #![feature( // Language Features impl_trait_in_assoc_type, diff --git a/libs/@local/graph/temporal-versioning/src/lib.rs b/libs/@local/graph/temporal-versioning/src/lib.rs index f7acba4bcbe..e61a95e53a8 100644 --- a/libs/@local/graph/temporal-versioning/src/lib.rs +++ b/libs/@local/graph/temporal-versioning/src/lib.rs @@ -1,7 +1,7 @@ //! # HASH Graph Temporal Versioning //! //! ## Workspace dependencies -#![cfg_attr(doc, doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd"))] +#![doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd")] mod axis; mod bounds; diff --git a/libs/@local/graph/type-defs/src/lib.rs b/libs/@local/graph/type-defs/src/lib.rs index 039ba0569b0..75a00df53b7 100644 --- a/libs/@local/graph/type-defs/src/lib.rs +++ b/libs/@local/graph/type-defs/src/lib.rs @@ -1,7 +1,7 @@ //! # HASH Graph Type Defs //! //! ## Workspace dependencies -#![cfg_attr(doc, doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd"))] +#![doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd")] pub mod error; pub mod status_payloads { diff --git a/libs/@local/graph/type-fetcher/Cargo.toml b/libs/@local/graph/type-fetcher/Cargo.toml index a0fce2afc5e..6bb48850818 100644 --- a/libs/@local/graph/type-fetcher/Cargo.toml +++ b/libs/@local/graph/type-fetcher/Cargo.toml @@ -30,7 +30,7 @@ derive_more = { workspace = true, features = ["display", "error"] } futures = { workspace = true } include_dir = { workspace = true, features = ["glob"] } opentelemetry = { workspace = true } -reqwest = { workspace = true, features = ["json"] } +reqwest = { workspace = true, features = ["json", "stream"] } reqwest-middleware = { workspace = true } reqwest-tracing = { workspace = true } serde = { workspace = true, features = ["derive"] } diff --git a/libs/@local/graph/type-fetcher/src/lib.rs b/libs/@local/graph/type-fetcher/src/lib.rs index 7041944cac5..14567e0b938 100644 --- a/libs/@local/graph/type-fetcher/src/lib.rs +++ b/libs/@local/graph/type-fetcher/src/lib.rs @@ -5,7 +5,7 @@ // Library Features ip, )] -#![cfg_attr(doc, doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd"))] +#![doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd")] extern crate alloc; diff --git a/libs/@local/graph/types/src/lib.rs b/libs/@local/graph/types/src/lib.rs index 23e7a6cd84e..8a9024d38e1 100644 --- a/libs/@local/graph/types/src/lib.rs +++ b/libs/@local/graph/types/src/lib.rs @@ -1,7 +1,7 @@ //! # HASH Graph Types //! //! ## Workspace dependencies -#![cfg_attr(doc, doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd"))] +#![doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd")] extern crate alloc; diff --git a/libs/@local/graph/validation/src/lib.rs b/libs/@local/graph/validation/src/lib.rs index fdac900b3ff..431d2cf91ab 100644 --- a/libs/@local/graph/validation/src/lib.rs +++ b/libs/@local/graph/validation/src/lib.rs @@ -1,7 +1,7 @@ //! # HASH Graph Validation //! //! ## Workspace dependencies -#![cfg_attr(doc, doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd"))] +#![doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd")] extern crate alloc; diff --git a/libs/@local/harpc/client/rust/src/lib.rs b/libs/@local/harpc/client/rust/src/lib.rs index 6a4f5304d97..689b5bf0ddd 100644 --- a/libs/@local/harpc/client/rust/src/lib.rs +++ b/libs/@local/harpc/client/rust/src/lib.rs @@ -1,7 +1,7 @@ //! # HaRPC Client //! //! ## Workspace dependencies -#![cfg_attr(doc, doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd"))] +#![doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd")] #![feature( // Language Features impl_trait_in_assoc_type, diff --git a/libs/@local/harpc/codec/src/lib.rs b/libs/@local/harpc/codec/src/lib.rs index 1d28ffc855e..cc1c47c495f 100644 --- a/libs/@local/harpc/codec/src/lib.rs +++ b/libs/@local/harpc/codec/src/lib.rs @@ -1,7 +1,7 @@ //! # HaRPC Codec //! //! ## Workspace dependencies -#![cfg_attr(doc, doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd"))] +#![doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd")] #![feature( // Library Features error_generic_member_access, diff --git a/libs/@local/harpc/net/src/lib.rs b/libs/@local/harpc/net/src/lib.rs index 74525ad8e42..ecc0f418d3f 100644 --- a/libs/@local/harpc/net/src/lib.rs +++ b/libs/@local/harpc/net/src/lib.rs @@ -1,7 +1,7 @@ //! # HaRPC Net //! //! ## Workspace dependencies -#![cfg_attr(doc, doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd"))] +#![doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd")] #![feature( // Language Features never_type, diff --git a/libs/@local/harpc/server/src/lib.rs b/libs/@local/harpc/server/src/lib.rs index 11bc7996c54..c2cf47c9608 100644 --- a/libs/@local/harpc/server/src/lib.rs +++ b/libs/@local/harpc/server/src/lib.rs @@ -1,7 +1,7 @@ //! # HaRPC Server //! //! ## Workspace dependencies -#![cfg_attr(doc, doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd"))] +#![doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd")] #![feature( // Language Features impl_trait_in_assoc_type, diff --git a/libs/@local/harpc/system/src/lib.rs b/libs/@local/harpc/system/src/lib.rs index 53bde6d73c7..b9e7106b1f1 100644 --- a/libs/@local/harpc/system/src/lib.rs +++ b/libs/@local/harpc/system/src/lib.rs @@ -1,7 +1,7 @@ //! # HaRPC System //! //! ## Workspace dependencies -#![cfg_attr(doc, doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd"))] +#![doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd")] #![feature( // Language Features marker_trait_attr, diff --git a/libs/@local/harpc/tower/src/lib.rs b/libs/@local/harpc/tower/src/lib.rs index e5c5c8b5921..5d90893b17a 100644 --- a/libs/@local/harpc/tower/src/lib.rs +++ b/libs/@local/harpc/tower/src/lib.rs @@ -1,7 +1,7 @@ //! # HaRPC Tower //! //! ## Workspace dependencies -#![cfg_attr(doc, doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd"))] +#![doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd")] #![feature( // Language Features impl_trait_in_assoc_type, diff --git a/libs/@local/harpc/types/src/lib.rs b/libs/@local/harpc/types/src/lib.rs index 205dec6faf2..a106b0e2681 100644 --- a/libs/@local/harpc/types/src/lib.rs +++ b/libs/@local/harpc/types/src/lib.rs @@ -1,7 +1,7 @@ //! # HaRPC Types //! //! ## Workspace dependencies -#![cfg_attr(doc, doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd"))] +#![doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd")] #![feature( // Language Features macro_metavar_expr, diff --git a/libs/@local/harpc/wire-protocol/src/lib.rs b/libs/@local/harpc/wire-protocol/src/lib.rs index d5434a91677..cdf9a043b33 100644 --- a/libs/@local/harpc/wire-protocol/src/lib.rs +++ b/libs/@local/harpc/wire-protocol/src/lib.rs @@ -11,7 +11,7 @@ //! An illustration of the protocol can be seen in the `docs/` folder of the project. //! //! ## Workspace dependencies -#![cfg_attr(doc, doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd"))] +#![doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd")] #![cfg_attr(test, feature(async_fn_track_caller))] #![feature( // Language Features diff --git a/libs/@local/hashql/ast/src/lib.rs b/libs/@local/hashql/ast/src/lib.rs index 74ff63dc56e..675db324cbd 100644 --- a/libs/@local/hashql/ast/src/lib.rs +++ b/libs/@local/hashql/ast/src/lib.rs @@ -44,7 +44,7 @@ //! [`heap`]: hashql_core::heap //! //! ## Workspace dependencies -#![cfg_attr(doc, doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd"))] +#![doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd")] #![expect(clippy::indexing_slicing)] #![feature( // Language Features diff --git a/libs/@local/hashql/compiletest/src/lib.rs b/libs/@local/hashql/compiletest/src/lib.rs index 2f231c4ca3e..e11f31eb982 100644 --- a/libs/@local/hashql/compiletest/src/lib.rs +++ b/libs/@local/hashql/compiletest/src/lib.rs @@ -1,5 +1,5 @@ //! ## Workspace dependencies -#![cfg_attr(doc, doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd"))] +#![doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd")] #![expect(clippy::indexing_slicing)] #![feature( // Language Features diff --git a/libs/@local/hashql/compiletest/src/main.rs b/libs/@local/hashql/compiletest/src/main.rs index 0379aea637e..f0621aa3ea1 100644 --- a/libs/@local/hashql/compiletest/src/main.rs +++ b/libs/@local/hashql/compiletest/src/main.rs @@ -1,5 +1,5 @@ //! ## Workspace dependencies -#![cfg_attr(doc, doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd"))] +#![doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd")] fn main() { hashql_compiletest::runner::cli::run(); diff --git a/libs/@local/hashql/core/Cargo.toml b/libs/@local/hashql/core/Cargo.toml index 8a6b5b68221..5cef818ed51 100644 --- a/libs/@local/hashql/core/Cargo.toml +++ b/libs/@local/hashql/core/Cargo.toml @@ -32,7 +32,6 @@ lexical = { workspace = true, features = ["parse-integers", "parse- memchr = { workspace = true } rapidfuzz = { workspace = true } roaring = { workspace = true, features = ["std"] } -rpds = { workspace = true } serde = { workspace = true, optional = true, features = ["alloc", "derive"] } simple-mermaid = { workspace = true } tracing = { workspace = true } diff --git a/libs/@local/hashql/core/src/lib.rs b/libs/@local/hashql/core/src/lib.rs index 3e5b5ffbeba..611b4e97486 100644 --- a/libs/@local/hashql/core/src/lib.rs +++ b/libs/@local/hashql/core/src/lib.rs @@ -1,7 +1,7 @@ //! # HashQL Core //! //! ## Workspace dependencies -#![cfg_attr(doc, doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd"))] +#![doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd")] #![expect(clippy::indexing_slicing)] #![feature( // Language Features diff --git a/libs/@local/hashql/diagnostics/Cargo.toml b/libs/@local/hashql/diagnostics/Cargo.toml index 9d661d1531c..9a73c4fe80f 100644 --- a/libs/@local/hashql/diagnostics/Cargo.toml +++ b/libs/@local/hashql/diagnostics/Cargo.toml @@ -21,7 +21,6 @@ annotate-snippets = { workspace = true, optional = true, features = ["simd"] } anstream = { workspace = true } anstyle-lossy = { workspace = true, optional = true } anstyle-svg = { workspace = true } -derive_more = { workspace = true, features = ["display"] } serde = { workspace = true, optional = true, features = ["derive", "alloc"] } simple-mermaid = { workspace = true } diff --git a/libs/@local/hashql/diagnostics/src/lib.rs b/libs/@local/hashql/diagnostics/src/lib.rs index 28f03988520..3b47083161e 100644 --- a/libs/@local/hashql/diagnostics/src/lib.rs +++ b/libs/@local/hashql/diagnostics/src/lib.rs @@ -1,7 +1,7 @@ //! # HashQL Diagnostics //! //! ## Workspace dependencies -#![cfg_attr(doc, doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd"))] +#![doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd")] #![feature( // Language Features const_trait_impl, diff --git a/libs/@local/hashql/eval/src/lib.rs b/libs/@local/hashql/eval/src/lib.rs index ec19faed689..410cbaf920d 100644 --- a/libs/@local/hashql/eval/src/lib.rs +++ b/libs/@local/hashql/eval/src/lib.rs @@ -1,7 +1,7 @@ //! # HashQL Eval //! //! ## Workspace dependencies -#![cfg_attr(doc, doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd"))] +#![doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd")] #![expect(clippy::indexing_slicing)] #![feature( // Language Features diff --git a/libs/@local/hashql/hir/src/lib.rs b/libs/@local/hashql/hir/src/lib.rs index 0fb6cf395a3..255b3d430bc 100644 --- a/libs/@local/hashql/hir/src/lib.rs +++ b/libs/@local/hashql/hir/src/lib.rs @@ -1,7 +1,7 @@ //! # HashQL HIR //! //! ## Workspace dependencies -#![cfg_attr(doc, doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd"))] +#![doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd")] #![expect(clippy::indexing_slicing)] #![feature( // Language Features diff --git a/libs/@local/hashql/mir/src/lib.rs b/libs/@local/hashql/mir/src/lib.rs index aecce9b1e49..687f4595c89 100644 --- a/libs/@local/hashql/mir/src/lib.rs +++ b/libs/@local/hashql/mir/src/lib.rs @@ -1,7 +1,7 @@ //! # HashQL MIR //! //! ## Workspace dependencies -#![cfg_attr(doc, doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd"))] +#![doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd")] #![feature( // Language Features associated_type_defaults, diff --git a/libs/@local/hashql/syntax-jexpr/src/lib.rs b/libs/@local/hashql/syntax-jexpr/src/lib.rs index 3b3c6749b6c..f1ee389aa8b 100644 --- a/libs/@local/hashql/syntax-jexpr/src/lib.rs +++ b/libs/@local/hashql/syntax-jexpr/src/lib.rs @@ -1,7 +1,7 @@ //! # HashQL J-Expr syntax //! //! ## Workspace dependencies -#![cfg_attr(doc, doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd"))] +#![doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd")] #![expect(clippy::indexing_slicing)] #![feature( // Language Features diff --git a/libs/@local/repo-chores/rust/src/lib.rs b/libs/@local/repo-chores/rust/src/lib.rs index 99ff652dc99..dc80b4aaf77 100644 --- a/libs/@local/repo-chores/rust/src/lib.rs +++ b/libs/@local/repo-chores/rust/src/lib.rs @@ -3,7 +3,7 @@ //! This crate contains a collection of utilities for managing and analyzing repositories. //! //! ## Workspace dependencies -#![cfg_attr(doc, doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd"))] +#![doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd")] #![feature( // Library Features core_io, diff --git a/libs/@local/status/rust/src/lib.rs b/libs/@local/status/rust/src/lib.rs index af25935b542..cbcb3f93f07 100644 --- a/libs/@local/status/rust/src/lib.rs +++ b/libs/@local/status/rust/src/lib.rs @@ -7,7 +7,7 @@ //! environments, including REST APIs and RPC APIs. //! //! ## Workspace dependencies -#![cfg_attr(doc, doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd"))] +#![doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd")] mod status_code; diff --git a/libs/@local/telemetry/Cargo.toml b/libs/@local/telemetry/Cargo.toml index f5e3c4ae40c..f8b573ddfeb 100644 --- a/libs/@local/telemetry/Cargo.toml +++ b/libs/@local/telemetry/Cargo.toml @@ -13,7 +13,7 @@ opentelemetry = { workspace = true, public = true } opentelemetry-otlp = { workspace = true, public = true, features = ["trace", "logs", "metrics", "grpc-tonic", "tls-ring", "tls-roots"] } # Public third-party dependencies -clap_builder = { workspace = true, public = true } +clap_builder = { workspace = true, public = true, optional = true } sentry-core = { workspace = true, public = true } sentry-types = { workspace = true, public = true } tokio = { workspace = true, public = true } @@ -36,7 +36,7 @@ tracing-flame = { workspace = true } tracing-opentelemetry = { workspace = true } [features] -clap = ["dep:clap"] +clap = ["dep:clap", "dep:clap_builder"] [lints] workspace = true diff --git a/libs/@local/telemetry/src/lib.rs b/libs/@local/telemetry/src/lib.rs index 0d85daab5f4..58b87881fa4 100644 --- a/libs/@local/telemetry/src/lib.rs +++ b/libs/@local/telemetry/src/lib.rs @@ -3,7 +3,7 @@ //! Tracing and logging utilities for the HASH platform. //! //! ## Workspace dependencies -#![cfg_attr(doc, doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd"))] +#![doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd")] #![feature( // Language Features type_alias_impl_trait, diff --git a/libs/@local/temporal-client/src/lib.rs b/libs/@local/temporal-client/src/lib.rs index cd0f1812284..835de035756 100644 --- a/libs/@local/temporal-client/src/lib.rs +++ b/libs/@local/temporal-client/src/lib.rs @@ -1,7 +1,7 @@ //! # Temporal Client //! //! ## Workspace dependencies -#![cfg_attr(doc, doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd"))] +#![doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd")] #![feature( // Language Features impl_trait_in_assoc_type, diff --git a/libs/error-stack/src/fmt/hook.rs b/libs/error-stack/src/fmt/hook.rs index c8caeffe4bd..139245340a6 100644 --- a/libs/error-stack/src/fmt/hook.rs +++ b/libs/error-stack/src/fmt/hook.rs @@ -465,6 +465,10 @@ mod default { #[cfg(feature = "std")] use std::sync::Once; + // `spin` is only referenced on no-std platforms; anchor it here so builds with both `std` + // and `hooks` enabled don't flag it as an unused dependency. + #[cfg(all(feature = "std", feature = "hooks"))] + use spin as _; #[cfg(all(not(feature = "std"), feature = "hooks"))] use spin::once::Once; #[cfg(feature = "spantrace")] diff --git a/tests/graph/test-data/rust/src/lib.rs b/tests/graph/test-data/rust/src/lib.rs index 531b67d3d15..885181de9c5 100644 --- a/tests/graph/test-data/rust/src/lib.rs +++ b/tests/graph/test-data/rust/src/lib.rs @@ -1,7 +1,7 @@ //! Test data for testing the Graph API. //! //! ## Workspace dependencies -#![cfg_attr(doc, doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd"))] +#![doc = simple_mermaid::mermaid!("../docs/dependency-diagram.mmd")] #![feature( // Language Features never_type, From e630b04e3487299031374e35b1ea0706b487b63d Mon Sep 17 00:00:00 2001 From: Tim Diekmann Date: Tue, 7 Jul 2026 19:08:30 +0200 Subject: [PATCH 2/5] BE-640: Harden CI clippy step (pipefail, error output, precise lint gate) --- .github/workflows/lint.yml | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 8884ea1f76e..ff1b06eb3fc 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -137,22 +137,34 @@ jobs: - name: Run clippy if: always() && steps.lints.outputs.clippy == 'true' run: | + set -o pipefail pushd ${{ matrix.path }} + clippy_exit=0 turbo run lint:clippy --filter "${{ matrix.name }}" -- --message-format=json \ | tee clippy-output.log \ | clippy-sarif \ | jq --arg path "${{ matrix.path }}" '.runs[].results |= map(select(.locations[].physicalLocation.artifactLocation.uri | startswith($path)))' \ | jq '.runs[].results |= unique' \ - > clippy.sarif + > clippy.sarif || clippy_exit=$? popd + + if [[ "$clippy_exit" -ne 0 ]]; then + # The JSON stream is consumed by the pipeline, so print the human-readable rest of + # the output to make the failure diagnosable. + grep -vF '{"reason":' ${{ matrix.path }}/clippy-output.log || true + exit "$clippy_exit" + fi + cat ${{ matrix.path }}/clippy.sarif | sarif-fmt jq -e '.runs[].results == []' ${{ matrix.path }}/clippy.sarif> /dev/null # Cargo's manifest lints (e.g. `cargo::unused_dependencies`) are emitted as plain text - # rather than compiler JSON messages, so they bypass the SARIF gate above. - if grep -E "warning: unused dependency|\(manifest\) generated" ${{ matrix.path }}/clippy-output.log; then - echo 'Cargo reported manifest lint warnings; see the lines above.' + # rather than compiler JSON messages, so they bypass the SARIF gate above. Only the + # package-level lint is checked: the workspace-level variant reports false positives + # here because the pruned repository no longer contains every workspace member. + if grep -F "warning: unused dependency" ${{ matrix.path }}/clippy-output.log; then + echo 'Cargo reported unused dependencies; see the lines above.' exit 1 fi From 04f09b548148c1094ca641498b7d2c8edfbbc653 Mon Sep 17 00:00:00 2001 From: Tim Diekmann Date: Tue, 7 Jul 2026 20:05:51 +0200 Subject: [PATCH 3/5] BE-640: Remove unused deps in 3 more crates, slim CI gate --- .github/workflows/lint.yml | 32 +++++++------------ Cargo.lock | 24 -------------- Cargo.toml | 1 - .../@local/graph/migrations-macros/Cargo.toml | 19 ++++++----- libs/@local/graph/validation/Cargo.toml | 4 --- libs/@local/harpc/client/rust/Cargo.toml | 1 - 6 files changed, 21 insertions(+), 60 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index ff1b06eb3fc..c8b85c97272 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -136,35 +136,27 @@ jobs: - name: Run clippy if: always() && steps.lints.outputs.clippy == 'true' + # `bash` gives us `pipefail`, so a failing `turbo`/`clippy` fails the step instead of + # being masked by a later pipeline stage exiting 0. + shell: bash run: | - set -o pipefail pushd ${{ matrix.path }} - clippy_exit=0 turbo run lint:clippy --filter "${{ matrix.name }}" -- --message-format=json \ | tee clippy-output.log \ | clippy-sarif \ | jq --arg path "${{ matrix.path }}" '.runs[].results |= map(select(.locations[].physicalLocation.artifactLocation.uri | startswith($path)))' \ | jq '.runs[].results |= unique' \ - > clippy.sarif || clippy_exit=$? + > clippy.sarif popd - - if [[ "$clippy_exit" -ne 0 ]]; then - # The JSON stream is consumed by the pipeline, so print the human-readable rest of - # the output to make the failure diagnosable. - grep -vF '{"reason":' ${{ matrix.path }}/clippy-output.log || true - exit "$clippy_exit" - fi - cat ${{ matrix.path }}/clippy.sarif | sarif-fmt - - jq -e '.runs[].results == []' ${{ matrix.path }}/clippy.sarif> /dev/null - - # Cargo's manifest lints (e.g. `cargo::unused_dependencies`) are emitted as plain text - # rather than compiler JSON messages, so they bypass the SARIF gate above. Only the - # package-level lint is checked: the workspace-level variant reports false positives - # here because the pruned repository no longer contains every workspace member. - if grep -F "warning: unused dependency" ${{ matrix.path }}/clippy-output.log; then - echo 'Cargo reported unused dependencies; see the lines above.' + jq -e '.runs[].results == []' ${{ matrix.path }}/clippy.sarif > /dev/null + + # Cargo's manifest lints (e.g. `cargo::unused_dependencies`) are plain text, not compiler + # JSON, so they bypass the SARIF gate above and were consumed by the pipeline. Re-print + # the human-readable output (dropping JSON) and fail on the package-level lint. The + # workspace-level variant is ignored: it false-positives in the pruned per-package repo. + if grep -qF "warning: unused dependency" ${{ matrix.path }}/clippy-output.log; then + grep -vF '{"reason":' ${{ matrix.path }}/clippy-output.log exit 1 fi diff --git a/Cargo.lock b/Cargo.lock index 61ffd548374..d22e064b196 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3288,7 +3288,6 @@ name = "harpc-client" version = "0.0.0" dependencies = [ "bytes", - "derive-where", "derive_more", "error-stack", "futures", @@ -3720,7 +3719,6 @@ version = "0.0.0" dependencies = [ "convert_case 0.11.0", "derive_more", - "proc-macro-error2", "proc-macro2", "quote", "regex", @@ -3930,7 +3928,6 @@ dependencies = [ "tokio", "type-system", "url", - "utoipa", "uuid", ] @@ -7607,27 +7604,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "proc-macro-error-attr2" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5" -dependencies = [ - "proc-macro2", - "quote", -] - -[[package]] -name = "proc-macro-error2" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802" -dependencies = [ - "proc-macro-error-attr2", - "proc-macro2", - "quote", -] - [[package]] name = "proc-macro2" version = "1.0.106" diff --git a/Cargo.toml b/Cargo.toml index 5eca94f0398..eb9a7fe491f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -214,7 +214,6 @@ postgres-types = { version = "0.2.11", default-features = fa pretty = { version = "0.12.5", default-features = false } pretty_assertions = { version = "1.4.1", default-features = false, features = ["alloc"] } prettyplease = { version = "0.2.37", default-features = false } -proc-macro-error2 = { version = "2.0.1", default-features = false } proc-macro2 = { version = "1.0.103", default-features = false } prometheus-client = { version = "0.24.0", default-features = false } proptest = { version = "1.7.0", default-features = false, features = ["alloc", "std"] } # `std` or `no_std` are required, `no_std` pulls in `libm` diff --git a/libs/@local/graph/migrations-macros/Cargo.toml b/libs/@local/graph/migrations-macros/Cargo.toml index 4492338c3e3..040f3f0ef3e 100644 --- a/libs/@local/graph/migrations-macros/Cargo.toml +++ b/libs/@local/graph/migrations-macros/Cargo.toml @@ -13,16 +13,15 @@ proc-macro = true # Workspace dependencies # Third-party dependencies -convert_case = { workspace = true } -derive_more = { workspace = true, features = ["display", "error", "from"] } -proc-macro-error2 = { workspace = true } -proc-macro2 = { workspace = true } -quote = { workspace = true } -regex = { workspace = true } -sha2 = { workspace = true } -simple-mermaid = { workspace = true } -syn = { workspace = true } -walkdir = { workspace = true } +convert_case = { workspace = true } +derive_more = { workspace = true, features = ["display", "error", "from"] } +proc-macro2 = { workspace = true } +quote = { workspace = true } +regex = { workspace = true } +sha2 = { workspace = true } +simple-mermaid = { workspace = true } +syn = { workspace = true } +walkdir = { workspace = true } [lints] workspace = true diff --git a/libs/@local/graph/validation/Cargo.toml b/libs/@local/graph/validation/Cargo.toml index b441eae54cc..4a559a63a1f 100644 --- a/libs/@local/graph/validation/Cargo.toml +++ b/libs/@local/graph/validation/Cargo.toml @@ -26,7 +26,6 @@ serde_json = { workspace = true } simple-mermaid = { workspace = true } thiserror = { workspace = true } url = { workspace = true } -utoipa = { workspace = true, optional = true } uuid = { workspace = true, features = ["std"] } [dev-dependencies] @@ -35,8 +34,5 @@ hash-graph-test-data = { workspace = true } tokio = { workspace = true, features = ["macros", "rt-multi-thread"] } -[features] -utoipa = ["dep:utoipa"] - [lints] workspace = true diff --git a/libs/@local/harpc/client/rust/Cargo.toml b/libs/@local/harpc/client/rust/Cargo.toml index 0c7a03001bc..361837babc3 100644 --- a/libs/@local/harpc/client/rust/Cargo.toml +++ b/libs/@local/harpc/client/rust/Cargo.toml @@ -23,7 +23,6 @@ harpc-types = { workspace = true } # Private third-party dependencies bytes = { workspace = true } -derive-where = { workspace = true } derive_more = { workspace = true, features = ["display"] } futures = { workspace = true } multiaddr = { workspace = true } From 46b3c8986b99ec157f063d86795069d0f38c1312 Mon Sep 17 00:00:00 2001 From: Tim Diekmann Date: Tue, 7 Jul 2026 20:46:14 +0200 Subject: [PATCH 4/5] BE-640: Mark futures-core public in hash-graph-store --- Cargo.lock | 1 + libs/@local/graph/store/Cargo.toml | 1 + 2 files changed, 2 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index d22e064b196..4d565d69b68 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3783,6 +3783,7 @@ dependencies = [ "derive_more", "error-stack", "futures", + "futures-core", "hash-codec", "hash-codegen", "hash-graph-authorization", diff --git a/libs/@local/graph/store/Cargo.toml b/libs/@local/graph/store/Cargo.toml index 825638c1e35..c8169997f42 100644 --- a/libs/@local/graph/store/Cargo.toml +++ b/libs/@local/graph/store/Cargo.toml @@ -14,6 +14,7 @@ hash-graph-types = { workspace = true, public = true } hash-temporal-client = { workspace = true, public = true } # Public third-party dependencies +futures-core = { workspace = true, public = true } postgres-types = { workspace = true, public = true, optional = true, features = ["derive", "with-serde_json-1", "with-uuid-1"] } specta = { workspace = true, public = true, optional = true, features = ["derive"] } tokio-postgres = { workspace = true, public = true, optional = true } From c59cdf2a60bbb647649fb12c023931bae4cb91fa Mon Sep 17 00:00:00 2001 From: Tim Diekmann Date: Wed, 8 Jul 2026 15:58:31 +0200 Subject: [PATCH 5/5] BE-640: Make bytes optional and anchor intersection deps in hash-codec --- libs/@local/codec/Cargo.toml | 11 ++++++----- libs/@local/codec/src/lib.rs | 21 +++++++++++++++++++++ 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/libs/@local/codec/Cargo.toml b/libs/@local/codec/Cargo.toml index 7d2d3801ffd..502548d71fb 100644 --- a/libs/@local/codec/Cargo.toml +++ b/libs/@local/codec/Cargo.toml @@ -13,7 +13,7 @@ harpc-wire-protocol = { workspace = true, public = true, optional = true } postgres-types = { workspace = true, public = true, optional = true } # Public third-party dependencies -bytes = { workspace = true, public = true } +bytes = { workspace = true, public = true, optional = true } regex = { workspace = true, public = true, optional = true } serde_core = { workspace = true, public = true, optional = true } specta = { workspace = true, public = true, optional = true, features = ["derive"] } @@ -45,8 +45,8 @@ name = "codegen" required-features = ["codegen", "numeric"] [features] -codegen = ["dep:specta"] bytes = [ + "dep:bytes", "dep:serde_core", "dep:serde", "dep:derive-where", @@ -54,6 +54,10 @@ bytes = [ "dep:tokio-util", "dep:error-stack", ] +codegen = ["dep:specta"] +harpc = ["dep:bytes", "dep:harpc-wire-protocol", "dep:tokio-util", "dep:error-stack"] +numeric = ["dep:dashu-base", "dep:dashu-float", "dep:derive_more"] +postgres = ["dep:bytes", "dep:postgres-types"] serde = [ "dep:serde_core", "dep:serde", @@ -62,9 +66,6 @@ serde = [ "dep:uuid", "dep:derive_more", ] -harpc = ["dep:harpc-wire-protocol", "dep:tokio-util", "dep:error-stack"] -numeric = ["dep:dashu-base", "dep:dashu-float", "dep:derive_more"] -postgres = ["dep:postgres-types"] utoipa = ["dep:utoipa"] [lints] diff --git a/libs/@local/codec/src/lib.rs b/libs/@local/codec/src/lib.rs index f30f9e2470b..e4755bdd989 100644 --- a/libs/@local/codec/src/lib.rs +++ b/libs/@local/codec/src/lib.rs @@ -5,6 +5,27 @@ extern crate alloc; +// `postgres` and `utoipa` pull `postgres-types`/`bytes` and `utoipa`, but those are only consumed +// by the `Real` integration in the `numeric` module, i.e. at the *intersection* of `numeric` and +// the respective feature. Cargo activates a dependency on the feature *union*, so enabling one +// side without `numeric` pulls the dependency without compiling a user of it. Anchor those +// combinations so `cargo::unused_dependencies` (checked across the merge-queue powerset) stays +// quiet. +// `bytes` is additionally pulled by `postgres` (for the `Real` `ToSql` impl), but also used +// directly by the `bytes` and `harpc` modules. Only anchor it when none of its consumers +// compile. +#[cfg(all( + feature = "postgres", + not(feature = "numeric"), + not(feature = "bytes"), + not(feature = "harpc") +))] +use bytes as _; +#[cfg(all(feature = "postgres", not(feature = "numeric")))] +use postgres_types as _; +#[cfg(all(feature = "utoipa", not(feature = "numeric")))] +use utoipa as _; + #[cfg(feature = "bytes")] pub mod bytes; #[cfg(feature = "harpc")]