cargo
cargo copied to clipboard
Lint if workspace dependency inheritance isn't used
What it does
If a package has a dependencies entry that specifies a source besides workspace = true, it fires
See also rust-lang/rust-clippy#10306
Advantage
For projects that want to be consistent on their dependencies across a workspace
Drawbacks
- #12162
- Packages cannot have different version requirements (#15526)
Example
[dependencies]
serde = "1"
Could be written as:
[workspace.dependencies]
serde = "1"
[dependencies]
serde.workspace = true
Alternatively, cargo-deny focuses on de-duplication, see https://embarkstudios.github.io/cargo-deny/checks/bans/diags.html#workspace-duplicate
We should consider the impact on #4242
Redundant with #13723