Best way to introduce dependency only for bench?

I have a dev-dependency that is only required for a benchmark comparison, which unfortunately is messing up my MSRV test in travis-ci. Is there a recommended way around this? I'd prefer to test that the code works with the older rust compiler, but also don't want to make the benchmark rely on a feature, which would be a pain. Is there anything less painful than creating a feature for the comparison code in the benchmark?

This probably rates poorly on your pain scale, but you could create a sub-crate in your workspace.

Perhaps you could have a feature that is enabled by default, and disable default features only when testing with the old compiler in CI? Then commands like cargo bench and cargo test will work out-of-the-box for regular development.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.