A note on conditional compilation
Hey,
I personally found this to be a bit of a surprise, so I'm sharing it in the hopes that it'll help someone out.
It's important to note that I'm not saying this is necessarily an issue, but something that I think might not immediately be intuitive for everyone.
When running cargo (doc|clippy|miri|test...), it's important to note that you're only running on the currently enabled feature set and target. If using conditional compilation for features or targets in your project, to cover 100% of your code (or the cases you wish to cover), you need to run on all features and combinations + all target platforms (when linting or testing for example).
To do this, there are two helpful methods:
For features: You can use cargo-hack or cargo-all-features to run on all feature combinations.
For targets: You can run different jobs in the CI for supported platforms. Some tools also support --target flags.
I've opened a PR to add this more prominently to the Conditional Compilation entry in the Rust reference.