An option to disable default-features crate and workspace wide #14866
Labels
C-feature-request
Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
S-triage
Status: This issue is waiting on initial triage.
Uh oh!
There was an error while loading. Please reload this page.
Problem
I see value in minimizing the dependency tree - only bring in what I actually use.
The problem is that, between me using workspaces and features being additive, this creates a lot of noise in my manifest files, making them much harder to read.
As an example:
A small project I'm working on now, a set of three connected libraries in a workspace. There is a total of seven external non-dev dependencies, plus one or two intra-workspace ones. A total of around three thousand lines of Rust.
default-features = false
is found an astonishing twenty six times among the four manifest files.I am most definitely not the only person doing this, as
cargo-deny
has a ban fordefault-features
To show what it looks like:
Proposed Solution
I would like an option that would allow me to, in one place, set
default-feature = false
for every dependency in the file manifest. Ideally, this would be three switches: separately for regular, dev and build dependencies.The big issue I see with such an addition is that it does not fit within the existing structure of the manifest file - the obvious place to put it would be under
dependencies
, but that would create a precedent of Cargo itself reserving crate names, which I do not think is a good idea.Other top level keys have their own roles, and adding this feature to them would not be suitable.
Just about the only option I see is adding a new top-level key to the manifest, perhaps one generally involved with governing default features. This option would be added under it.
Notes
#3126 may be relevant to this discussion.
The text was updated successfully, but these errors were encountered: