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] )

allow_feature_sets replaces the powerset entirely. When you want to keep a powerset but shape it, reach for a different key:

WantUse
Only these exact sets, nothing elseallow_feature_sets
Powerset, but only over these featuresonly_features
Powerset, plus these exact setsinclude_feature_sets
Powerset, minus these featuresexclude_features
Powerset, minus these groupingsexclude_feature_sets

For example, to keep the powerset but restrict it to a subset of features:

[package.metadata.cargo-fc]
only_features = ["hydrate", "ssr"]

See Shaping the feature matrix.