Rust CLI Troubleshooting: Manifest, Packages, and Workspaces/Declare optional dependencies with features
Avoid feature-resolution confusion.
Section: Manifest repair snippets
Declare optional dependencies with features
toml
toml
[dependencies]
clap = { version = "4", features = ["derive"] }
serde_json = { version = "1", optional = true }
[features]
default = []
json = ["dep:serde_json"]Explanation
Feature wiring mistakes in `Cargo.toml` are a common source of build confusion in CLI apps.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Manifest repair snippets