21

From reading this page, it states that you need to turn off all defaults to override them.

With the exception of the default feature, all features are opt-in. To opt out of the default feature, use default-features = false and cherry-pick individual features.

Other build systems I've used (CMake, SCons, Autotools, Jam) all allow to change a single default.

Is this possible with Cargo?


This is useful because in most cases I want to use default options, with only minor adjustments. Its also important to me that in the future - new features which the developers think should be enabled by default, are not disabled on my build because I chose to adjust an unrelated feature.

Edit: opened issue regarding this feature.

ljedrz
  • 20,316
  • 4
  • 69
  • 97
ideasman42
  • 42,413
  • 44
  • 197
  • 320

2 Answers2

8

Currently, No. You have to disable all "default" features, then opt back in for the ones you want. So you have to know what the "default" list is, and opt-back-in for all but the one you want to omit.

This GH issue describes the status and discusses possibilities, but remains open (3y later).

Andrew Mackenzie
  • 5,477
  • 5
  • 48
  • 70
6

This is not currently possible, but your motivation sounds reasonable. Ideas for improvements to Cargo can be submitted as GitHub issues or (for more major things than this) RFCs.

durka42
  • 1,502
  • 10
  • 17