Restrict the matrix to specific configurations#
Scenario: a web app can be built in three rendering modes — hydrate, ssr, csr — but you only ever ship hydrate and ssr. You don’t want a powerset; you want exactly those two configurations.
[package]
name = "webapp"
version = "0.1.0"
edition = "2024"
[features]
hydrate = []
ssr = []
csr = []
[package.metadata.cargo-fc]
# Only ever test the two modes we ship — no powerset.
allow_feature_sets = [["hydrate"], ["ssr"]]
[workspace]When allow_feature_sets is non-empty, the matrix is exactly those sets — no powerset, no empty set, and csr is never tested:
$ cargo fc --summary-only check Checking [1/2] webapp ( features = [hydrate] ) Checking [2/2] webapp ( features = [ssr] ) Finished 2 feature combinations for 1 package in 0.00s PASS webapp ( 0 errors, 0 warnings, features = [hydrate] ) PASS webapp ( 0 errors, 0 warnings, features = [ssr] )
Related knobs#
allow_feature_sets replaces the powerset entirely. When you want to keep a powerset but shape it, reach for a different key:
| Want | Use |
|---|---|
| Only these exact sets, nothing else | allow_feature_sets |
| Powerset, but only over these features | only_features |
| Powerset, plus these exact sets | include_feature_sets |
| Powerset, minus these features | exclude_features |
| Powerset, minus these groupings | exclude_feature_sets |
For example, to keep the powerset but restrict it to a subset of features:
[package.metadata.cargo-fc]
only_features = ["hydrate", "ssr"]