And on the heels of my last post regarding feature flags, I have a follow-up.
Say I have:
[dependencies]
serde = { version = "1.0", optional = true }
[dev-dependencies]
serde_json = "1.0"
and have successfully defined serde trait implementations for my types, but guarded by #[cfg(feature = "serde")]. In a tests/serde.rs I've got:
#[test]
fn serde_instances() {
assert!(serde_json::from_str::<Kanji>("合").is_ok());
}
but the compiler complains that the Deserialize instance is missing. I realize that I can call cargo test --features=serde and get it to work, but is it possible to force the test suite to always assume that feature flag?
Please and thanks.