Skip to content

Add warning for unused workspace dependency #13723

@legounix

Description

@legounix

Problem

I have a workspace project with a database crate that uses diesel for sql stuff. All the dependencies are specified at workspace level. To make sure libsqlite3-sys is bundling sqlite3, i need to activate the "bundled" feature. Therefore I added it as transitive dependency in the workspace dependencies. The database crate didn't pick up this transitive dependency though, as long as i didn't add libsqlite3-sys.workspace = true to the database Cargo.toml.

Steps

  1. Create workspace
  2. Create database crate
  3. Add workspace dependency for diesel
  4. Use diesel in database crate
  5. cargo tree -e features
  6. Add libsqlite3-sys dependency with "bundled" feature to workspace
  7. cargo tree - features shows that database crate is not using transitive libsqlite3-sys dependency

Possible Solution(s)

I think it would be helpful if cargo would report this as a warning.

Notes

No response

Version

cargo 1.75.0 (1d8b05cdd 2023-11-20)
release: 1.75.0
commit-hash: 1d8b05cdd1287c64467306cf3ca2c8ac60c11eb0
commit-date: 2023-11-20
host: x86_64-unknown-linux-gnu
libgit2: 1.7.1 (sys:0.18.1 vendored)
libcurl: 8.4.0-DEV (sys:0.4.68+curl-8.4.0 vendored ssl:OpenSSL/1.1.1u)
ssl: OpenSSL 1.1.1u  30 May 2023
os: Red Hat Enterprise Linux 9.3.0 [64-bit]

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-new-lintArea: new lintC-bugCategory: bugS-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions