Analyze Cargo.toml dependencies and attempt to remove unused features to reduce compile times and binary size
This skill analyzes Cargo.toml dependencies to identify and remove unused features.
Many crates enable features by default that may not be needed. This skill:
default-features = false worksAsk the user which crate(s) to analyze:
For the workspace Cargo.toml (quickwit/Cargo.toml), list dependencies that:
default-features = falseRun: cargo tree -p <crate> -f "{p} {f}" --edges features to see what features are actually used.
Look up the crate on crates.io or check its Cargo.toml to understand:
Use: cargo metadata --format-version=1 | jq '.packages[] | select(.name == "<crate>") | .features'
Modify the dependency in quickwit/Cargo.toml:
From:
some-crate = { version = "1.0" }
To:
some-crate = { version = "1.0", default-features = false }
Run: cargo check --workspace (or target specific packages for faster feedback)
If compilation fails:
some-crate = { version = "1.0", default-features = false, features = ["needed-feature"] }
If there are many default features, use binary search:
For each dependency analyzed, report:
After all changes, run:
cargo check --workspace --all-targets
cargo test --workspace --no-run
Often only needs derive:
serde = { version = "1.0", default-features = false, features = ["derive", "std"] }
Identify which runtime features are actually used:
tokio = { version = "1.0", default-features = false, features = ["rt-multi-thread", "macros", "sync"] }
Often doesn't need all TLS backends:
reqwest = { version = "0.11", default-features = false, features = ["rustls-tls", "json"] }
If changes cause issues:
git checkout quickwit/Cargo.toml
cargo check --workspace
cargo bloat --crates to identify large dependenciescargo tree -d for duplicate dependencies that might indicate feature conflicts[dev-dependencies] features