cargo-feature-dep-checker

Crates.iocargo-feature-dep-checker
lib.rscargo-feature-dep-checker
version0.1.3
created_at2025-12-10 17:57:25.693318+00
updated_at2025-12-13 20:32:23.688365+00
descriptionValidates feature dependencies in Cargo.toml files
homepage
repositoryhttps://github.com/bensantora/cargo-feature-dep-checker
max_upload_size
id1978533
size16,266
Ben Santora (bensantora)

documentation

README

Project retired

This crate is no longer actively maintained. The repository has been archived and no additional development or support will occur.

I consent to the transfer of this crate to the first person who asks help@crates.io for it.

Thank you for any past interest and usage.

cargo-feature-dep-checker

A Cargo subcommand that validates feature dependencies in Cargo.toml files.

What it does

Checks that:

  • Features that depend on other features reference features that actually exist
  • Features that reference optional dependencies reference dependencies that are actually declared as optional
  • The feature dependency graph is valid

Installation

cargo install --path .

Or from crates.io (once published):

cargo install cargo-feature-dep-checker

Usage

Run from a Rust project directory:

cargo feature-dep-checker

Or specify a path to a Cargo.toml:

cargo feature-dep-checker /path/to/Cargo.toml

Example

Given a Cargo.toml with broken feature dependencies:

[features]
default = ["std"]
std = []
nightly = ["special"]  # Error: "special" feature doesn't exist
broken = ["missing-dep"]  # Error: "missing-dep" not an optional dependency

Running cargo feature-dep-checker will report:

Found 2 error(s):

  Feature 'nightly' depends on 'special' which is not defined as a feature or optional dependency
  Feature 'broken' depends on 'missing-dep' which is not defined as a feature or optional dependency

Exit codes

  • 0 - All feature dependencies are valid
  • 1 - Errors found or invalid Cargo.toml

Testing

Run the test suite:

cargo test

The tests verify:

  • Valid feature-to-feature dependencies
  • Missing feature dependencies are detected
  • Valid optional dependency references
  • Invalid optional dependency references
  • Dev-dependencies are checked
  • dep: prefix is properly ignored
  • Multiple errors are reported correctly

License

  • MIT

Author

  • Ben Santora
Commit count: 0

cargo fmt