Repository navigation
build: fix Cargo 1.100's unused dependency warnings - #500
Merged
Merged
Conversation
Cargo 1.100 adds two manifest lints that warn by default. CI denies warnings, so the Build job and every feature powerset job fail on `main`. - `cargo::unused_dependencies` flags `agent-client-protocol-rmcp` in the cookbook. Only rustdoc links and doctests use it, and rustdoc resolves links against regular dependencies only, so it has to stay one. Name the crate with `use agent_client_protocol_rmcp as _;`. - `cargo::unused_workspace_dependencies` flags nine workspace dependencies in the powerset jobs. `cargo hack --no-dev-deps` removes dev-dependencies from the manifests while it runs, and only dev-dependencies inherit those entries. Deny compiler warnings only in that step (`CARGO_BUILD_WARNINGS=warn`, `RUSTFLAGS=-D warnings`). The Build job still denies Cargo's warnings for the real manifests.
…onal Replace the relaxed warning settings on the feature powerset step. `cargo hack --no-dev-deps` removes dev-dependencies from the manifests while it runs, which is what made Cargo report nine workspace dependencies as unused. The flag is not needed with resolver 3: dev-dependencies do not add features to the library and binary targets the job checks. Remove it and keep denying every warning. With every warning denied, the job reports that `agent-client-protocol-rmcp` declares dependencies it does not use without `rmcp_3`, where the crate is empty. Make them optional and enable them from `rmcp_3`. The `unstable_mcp_over_acp` passthrough becomes `agent-client-protocol?/unstable_mcp_over_acp`, so on its own it no longer enables the core crate's feature.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CI on
mainfails with the current stable toolchain. Cargo 1.100 adds two manifest lints that warn by default, and CI denies warnings (CARGO_BUILD_WARNINGS=deny, set bysetup-rust-toolchain). The last green run onmainused 1.99.1. #499 is the first run on 1.100, and its Build job and all eight feature powerset jobs fail for this reason.No warning is relaxed or allowed here. Each one is fixed where it comes from.
Fixes
cargo::unused_workspace_dependenciesin the feature powerset jobs.cargo hack --no-dev-depsremoves dev-dependencies from the manifests while it runs. Nine[workspace.dependencies]entries are only inherited by dev-dependencies, so Cargo reported them as unused in every combination. The flag is gone. It is not needed with resolver 3: a library-only check ofagent-client-protocolwith--no-default-featuresresolves no features, even though its dev-dependencyagent-client-protocol-testdepends back on it withprocessandstdio.cargo::unused_dependenciesinagent-client-protocol-rmcp. With the flag gone, the powerset reports that the crate declares dependencies it does not use withoutrmcp_3, where the crate is empty. Its eight dependencies are now optional andrmcp_3enables them. No new feature names appear, because the feature refers to them withdep:.cargo::unused_dependenciesin the cookbook. Only rustdoc links and doctests useagent-client-protocol-rmcpthere, and rustdoc resolves links against regular dependencies only, so it cannot move to[dev-dependencies]. The cookbook now names the crate withuse agent_client_protocol_rmcp as _;.Behavior change
agent-client-protocol-rmcpwith onlyunstable_mcp_over_acp, and normcp_3, no longer enables the core crate's feature. The passthrough is nowagent-client-protocol?/unstable_mcp_over_acp, and the core crate is not a dependency in that configuration. Nothing in the workspace uses that combination. The README andmd/features.mdsay so.Verification
Run locally on Rust 1.100 with
CARGO_BUILD_WARNINGS=deny, as in CI:--each-featureinstead of--feature-powerset --depth 2(33 combinations), and the full powerset ofagent-client-protocol-rmcp. I did not run the full depth-2 powerset locally.cargo check --workspace --all-targets --all-features --lockedand the wasm checks from the MSRV jobcargo fmt -- --check,cargo clippy,cargo clippy --all-targets --all-features, and the wasm clippy commandsjust testAn earlier run of
just teston this branch failed once inacp_agent::tests::protocol_eof_still_reports_nonzero_child_exit. That test is flaky onmain(3 failures in 60 local runs of theacp_agenttests) and unrelated to this change.