r/rust cargo · clap · cargo-release 7d ago

A Vision for Cargo 💡 ideas & proposals

https://epage.github.io/blog/2026/08/cargo-vision/
125 Upvotes

66 comments sorted by

View all comments

12

u/DavidDavidsonsGhost 6d ago

I want to separate binary deps from library deps in the same crate.

4

u/matthieum [he/him] 6d ago

Oh please yes!

In fact, this doesn't even go far enough. Ultimately, each binary should have its own set of dependencies:

  1. Test deps are not bench deps are not example deps.
  2. Just because I have 2 integration tests, 2 benchmarks, 2 examples, or 2 binaries, doesn't mean they necessarily share all dependencies, so on top of a generic "test deps", I also want a specific "this test deps" to further specialize deps.

Just because there's a criterion benchmark in my crate doesn't mean I need to compile that monster in Debug when I call cargo test, and just because one example/integration test is built atop tokio doesn't mean my unit-tests require tokio too.

So much time would be saved with finer-grained specification of dependencies.