cargo icon indicating copy to clipboard operation
cargo copied to clipboard

Lint if workspace dependency inheritance isn't used

Open epage opened this issue 7 months ago • 2 comments

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

epage avatar May 22 '25 15:05 epage

Alternatively, cargo-deny focuses on de-duplication, see https://embarkstudios.github.io/cargo-deny/checks/bans/diags.html#workspace-duplicate

epage avatar May 22 '25 16:05 epage

We should consider the impact on #4242

epage avatar May 27 '25 17:05 epage

Redundant with #13723

epage avatar Aug 20 '25 14:08 epage