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]
:
```toml [package.metadata.cargo-all-features]
skipfeaturesets = [ ["foo", "bar"], ]
skipoptionaldependencies = true
extra_features = [ "log", ]
denylist = ["foo", "bar"]
skip_feature_sets
or denylist
, they getalwaysincludefeatures = ["baz"]
always_include_features
.maxcombinationsize = 4
denylist
, skip_optional_dependencies
, and extra_features
)allowlist = ["foo", "bar"] ```
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.