ci: check unused dependencies with cargo machete - #2513
Conversation
|
✅ All CI checks and tests passed. 🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: 00cf7f0 | Docs | View more details | Give us feedback! |
Artifact Size Benchmark Reportaarch64-alpine-linux-musl
aarch64-unknown-linux-gnu
libdatadog-x64-windows
libdatadog-x86-windows
x86_64-alpine-linux-musl
x86_64-unknown-linux-gnu
|
BenchmarksComparisonBenchmark execution time: 2026-09-11 15:28:46 Comparing candidate commit 00cf7f0 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 176 metrics, 0 unstable metrics.
|
dba21b5 to
3614e40
Compare
5f5673a to
b251c3c
Compare
The direct dependency intentionally constrains transitive resolution below\n0.8.3, which cargo-machete cannot detect from source imports.
b251c3c to
00cf7f0
Compare
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 00cf7f0ded
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| [workspace.metadata.cargo-machete] | ||
| ignored = [ |
There was a problem hiding this comment.
Scope false-positive exemptions to their packages
Placing these names under workspace.metadata.cargo-machete exempts each dependency in every workspace crate, not merely the package where its current use is a false positive; cargo-machete's configuration documentation distinguishes these workspace-wide exemptions from per-package metadata. Consequently, an unused anyhow, criterion, cc, or other listed dependency added to any of the many unrelated manifests will still pass this new check, defeating its stated purpose for those common dependencies. Move each exemption to the applicable crate's package.metadata.cargo-machete table.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
I personally prefer it centralized this way even if it adds a small change that a true-positive is not raised in the future.
Here's what it would look like otherwise. I don't find it worth it
| "cargo-platform", | ||
| "getrandom", | ||
| "libdd-capabilities-impl", | ||
| "rustls-native-certs", |
There was a problem hiding this comment.
It can be removed, it's been replaced by rustls-platform-verifier (which depends on it)
What does this PR do?
Runs cargo-machete in CI and records the audited false positives in each package manifest.
This PR is stacked on #2511.
Motivation
Prevent unused dependencies from being added without removing dependencies required by build scripts, targets, or feature resolution. APMSP-3056
How to test the change?
CI should pass the cargo machete check.
[Generated using codex]