Skip to content

X0029 shear-misplaced-deps

Rule: A dependency only tests use is a dev-dependency.

Code X0029 (stable, never reused)
Id shear-misplaced-deps
Category shear
Source cargo-shear (run as an executable)
Fix by hand
Needs cargo-shear installed

Level per tier

Tier Level Reason
small off
small-workspace off
medium off
big off
ai off
embedded off
ui off
egui off
units-strict off
units-paranoid off

Why

A dependency used only by tests, examples or benches belongs in [dev-dependencies]; in [dependencies] every downstream build compiles it for nothing. cargo-shear reports such dependencies.

How to fix

Move the dependency to [dev-dependencies].

Configure

[lints.shear-misplaced-deps]
level = "deny"
reason = "why this project wants it at this level"

Allow one finding in the code with // spirit-level: allow(shear-misplaced-deps) <reason> (waivers); the code works there too, as in [lints.X0029].