Quick start#
This walks through a first run and how to read the output. It assumes cargo fc is installed.
1. Run a command across the matrix#
From any crate or workspace, prefix a cargo command with fc:
cargo fc checkcargo fc enumerates the combinations of your features, runs cargo check against each, and prints a summary:
$ cargo fc --summary-only check --workspace Checking [1/6] cli ( features = [] ) Checking [2/6] cli ( features = [color] ) Checking [3/6] engine ( features = [] ) Checking [4/6] engine ( features = [metrics] ) Checking [5/6] engine ( features = [metrics, tracing] ) Checking [6/6] engine ( features = [tracing] ) 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] )
Each row is one combination: the package, whether it passed, its error/warning counts, and the exact feature set. A non-zero exit status means at least one combination failed.
2. Try other commands#
Any cargo command works — arguments are forwarded through:
cargo fc clippy
cargo fc test
cargo fc build --all-targets
cargo fc check -p my-crateThe only arguments cargo fc manages itself are --features, --all-features, and --no-default-features, because those define the matrix.
3. Cut the output down#
Large matrices produce a lot of text. Focus on what matters:
# Only warnings and errors, no build chatter
cargo fc --diagnostics-only clippy
# The same, but fold identical diagnostics that repeat across combinations
cargo fc --dedupe clippy
# Only the final result table
cargo fc --summary-only check
# Stop at the first failing combination
cargo fc --fail-fast testSee Output modes for the full set.
4. Get a matrix for CI#
$ cargo fc matrix --pretty
[
{
"features": "",
"metadata": {
"ci": true,
"kind": "bin"
},
"name": "cli",
"target": "x86_64-unknown-linux-gnu"
},
{
"features": "color",
"metadata": {
"ci": true,
"kind": "bin"
},
"name": "cli",
"target": "x86_64-unknown-linux-gnu"
},
{
"features": "",
"metadata": {
"ci": true,
"kind": "lib"
},
"name": "engine",
"target": "x86_64-unknown-linux-gnu"
},
{
"features": "metrics",
"metadata": {
"ci": true,
"kind": "lib"
},
"name": "engine",
"target": "x86_64-unknown-linux-gnu"
},
{
"features": "metrics,tracing",
"metadata": {
"ci": true,
"kind": "lib"
},
"name": "engine",
"target": "x86_64-unknown-linux-gnu"
},
{
"features": "tracing",
"metadata": {
"ci": true,
"kind": "lib"
},
"name": "engine",
"target": "x86_64-unknown-linux-gnu"
}
]Feed this into a GitHub Actions matrix to build every combination in parallel — see Continuous integration.
5. Shape the matrix#
When the powerset is too much (or contains combinations that can’t compile), configure it in Cargo.toml:
[package.metadata.cargo-fc]
# Never enable these two features together.
exclude_feature_sets = [["postgres", "sqlite"]]
# Ignore the implicit features generated for optional dependencies.
skip_optional_dependencies = true
# Drop the `default` feature from the varied set.
exclude_features = ["default"]Re-run cargo fc check and the matrix reflects the configuration. Continue with Configuration to learn the full model, or browse the Recipes for ready-made setups.