cosmwasm-std is specified as a dependency without default-features = false, so pulling in MultiTest enables the default features even if I don't enable the corresponding cw-multi-test feature.
It should instead be specified as cosmwasm-std = { version = "2.0.4", default-features = false }
The same problem also happens with cw-storage-plus, since that enables cosmwasm-std/iterator if default features stay enabled.
In general, it's good practice to always use default-features = false for dependencies of a library and enable all needed features manually to minimize enabled features.
This just bit me when implementing something in cw-utils that needs to differentiate between iterator or not-iterator. When I pull in cw-multi-test as dev-dep, iterator is always enabled in tests, but not outside of tests. This makes it impossible for me to control it with my own crate feature in cw-utils.
cosmwasm-std is specified as a dependency without
default-features = false
, so pulling in MultiTest enables the default features even if I don't enable the corresponding cw-multi-test feature.It should instead be specified as
cosmwasm-std = { version = "2.0.4", default-features = false }
The same problem also happens withcw-storage-plus
, since that enablescosmwasm-std/iterator
if default features stay enabled.In general, it's good practice to always use
default-features = false
for dependencies of a library and enable all needed features manually to minimize enabled features.This just bit me when implementing something in cw-utils that needs to differentiate between iterator or not-iterator. When I pull in cw-multi-test as dev-dep, iterator is always enabled in tests, but not outside of tests. This makes it impossible for me to control it with my own crate feature in cw-utils.