Cargo health · Dependencies
Regular dependency only used by tests or examples
rust_doctor::cargo::test_only_dependency
Move the entry to [dev-dependencies]: only the test suite references it, and every consumer of the library compiles it anyway.
- Category
- Dependencies
- Default level
- warn
- Tier
- P2
- Producer
- Cargo health
- Diff scope
- line
Not a defect when
Library consumers really need the crate through a path the scan cannot see, such as a public macro's expansion that names it or a feature-gated module.
What it reads
Cargo.toml, Cargo.lock and .cargo/config.toml.
Tier
Ordinary defect.
The tier bounds how severe a rule may be; its category bounds the tier.Diff scope
The changed line itself.
What--scope contextual looks at to decide whether a change caused the finding.Change it
Turn it off, or make it blocking, without touching the code it flags:
rust-doctor --rule rust_doctor::cargo::test_only_dependency=off .
rust-doctor --rule rust_doctor::cargo::test_only_dependency=error .