Awesome Reviewers

Reviewer · Configurations

Cargo dependency and feature hygiene

Treat Cargo.toml changes (new dependencies, feature flags, dev-dependencies) as configuration decisions with downstream impact, not just version bumps.

Instruction

Treat Cargo.toml changes (new dependencies, feature flags, dev-dependencies) as configuration decisions with downstream impact, not just version bumps.

  • Vet new dependencies before adding them: check maintenance activity, maintainer trust, and license compatibility. For small, thin crates, consider whether vendoring the code is a safer alternative to taking on an external dependency.
  • Avoid duplicating version strings across member crates. Declare shared dependencies once in the root [workspace.dependencies] table and reference them with dep.workspace = true in each crate, e.g.:
    # root Cargo.toml
    [workspace.dependencies]
    serde_test = "1.0.177"
    
    # crates/foo/Cargo.toml
    [dev-dependencies]
    serde_test.workspace = true
    
  • When introducing optional feature flags, explicitly scope their impact: features that only affect the compiled binary (e.g., bundling jemalloc or openssl statically) carry lower risk than ones touching library source/behavior. Document this scope, and ensure CI validates any feature combination that affects library code; binary-only features can rely on downstream consumers (e.g., rust-lang/rust CI) to validate their specific build configurations, as long as that expectation is documented and agreed upon.