cargo‑feature‑combinations
A cargo subcommand that runs a command against combinations of a crate's features and reports the results. Open source, MIT-licensed.
$ cargo fc check --workspace Checking [1/6] cli ( features = [] ) Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.00s Checking [2/6] cli ( features = [color] ) Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.00s Checking [3/6] engine ( features = [] ) Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.00s Checking [4/6] engine ( features = [metrics] ) Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.00s Checking [5/6] engine ( features = [metrics, tracing] ) Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.00s Checking [6/6] engine ( features = [tracing] ) Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.00s Finished 6 feature combinations for 2 packages in 0.00s PASS cli ( 0 errors, 0 warnings, features = [] ) PASS cli ( 0 errors, 0 warnings, features = [color] ) PASS engine ( 0 errors, 0 warnings, features = [] ) PASS engine ( 0 errors, 0 warnings, features = [metrics] ) PASS engine ( 0 errors, 0 warnings, features = [metrics, tracing] ) PASS engine ( 0 errors, 0 warnings, features = [tracing] )
What it does#
Cargo features are additive in principle, but a crate can compile with its default set and fail with --no-default-features, or fail only when two features are enabled together. Testing the default set — or --all-features — doesn’t exercise those cases.
cargo fc enumerates combinations of a crate’s features, runs a cargo command against each, and prints one summary. It works on single crates and workspaces, can drive the run across several target triples, and can emit a JSON matrix for CI.
Feature matrix
Runs a command against the powerset of a crate's features. Prune, restrict, or pin combinations from Cargo.toml.
Output modes
Reduce output to warnings and errors, deduplicate diagnostics across combinations, or show only the summary.
CI matrix
cargo fc matrix prints a JSON matrix for a GitHub Actions build matrix — one row per combination.
Targets
Check every combination across multiple target triples, with a zig-based driver for cross-compiling native-C dependencies.
Example#
# Install
cargo install --locked cargo-feature-combinations
# Run a command across the feature matrix
cargo fc check
cargo fc clippy
cargo fc test
# Warnings and errors only, deduplicated across combinations
cargo fc --dedupe clippy
# A JSON matrix for CI
cargo fc matrix --prettyDocumentation#
- Introduction and Installation.
- Quick start — a first run and how to read the output.
- Configuration — shape the matrix, including per-target and per-command overrides.
- Recipes — configurations for common scenarios.
- Continuous integration — use the matrix in GitHub Actions.