#cargo #feature-flags #testing

bin+lib cargo-all-features

A Cargo subcommand to build and test all feature flag combinations

12 stable releases

1.10.0 Jul 31, 2023
1.9.0 Mar 24, 2023
1.8.0 Jan 18, 2023
1.7.0 Apr 7, 2022
1.2.0 May 25, 2020

#36 in Cargo plugins

Download history 4978/week @ 2023-08-13 7450/week @ 2023-08-20 6841/week @ 2023-08-27 6062/week @ 2023-09-03 6611/week @ 2023-09-10 5803/week @ 2023-09-17 4689/week @ 2023-09-24 4898/week @ 2023-10-01 3379/week @ 2023-10-08 3951/week @ 2023-10-15 3408/week @ 2023-10-22 2506/week @ 2023-10-29 3072/week @ 2023-11-05 3053/week @ 2023-11-12 3645/week @ 2023-11-19 3337/week @ 2023-11-26

13,427 downloads per month
Used in serde_string_enum


608 lines


Cargo subcommands that build and test all feature flag combinations for a crate.


cargo install cargo-all-features


The following commands can be run within a Cargo package or at the root of a Cargo workspace.

Build crate with all feature flag combinations:

cargo build-all-features <CARGO BUILD FLAGS>

Check crate with all feature flag combinations:

cargo check-all-features <CARGO CHECK FLAGS>

Test crate with all feature flag combinations:

cargo test-all-features <CARGO TEST FLAGS>


If you have a crate that utilizes Rust feature flags, it’s common to set up a test matrix in your continuous integration tooling to individually test all feature flags. This setup can be difficult to maintain and easy to forget to update as feature flags come and go. It’s also not exhaustive, as it’s possible enabling combinations of feature flags could result in a compilation error that should be fixed. This utility was built to address these concerns.


You can add the following options to your Cargo.toml file to configure the behavior of cargo-all-features under the heading [package.metadata.cargo-all-features]:


# Features "foo" and "bar" are incompatible, so skip permutations including them
skip_feature_sets = [
    ["foo", "bar"],

# If your crate has a large number of optional dependencies, skip them for speed
skip_optional_dependencies = true

# Add back certain optional dependencies that you want to include in the permutations
extra_features = [

# Exclude certain features from the build matrix
denylist = ["foo", "bar"]

# Always include these features in combinations.
# These features should not be included in `skip_feature_sets` or `denylist`, they get
# added in later
always_include_features = ["baz"]

# The maximum number of features to try at once. Does not count features from `always_include_features`.
# This is useful for reducing the number of combinations run for a crate with a large amount of features,
# since in most cases a bug just needs a small set of 2-3 features to reproduce.
max_combination_size = 4

# Only include certain features in the build matrix
#(incompatible with `denylist`, `skip_optional_dependencies`, and `extra_features`)
allowlist = ["foo", "bar"]

The project also supports chunking: --n-chunks 3 --chunks 1 will split the crates being tested into three sets (alphabetically, currently), and run the requested command for the first set of crates only. This is useful for splitting up CI jobs or performing disk cleanups since for large workspaces check-all-features and friends can take a very long time and produce a ton of artifacts.


Licensed under either of

at your option.


Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


~47K SLoC