Criterion Benches in multiple files

I am a little confused by file organisation in criterion. I would like to put benches into different files, just for grouping.

The documentation says

Currently, Cargo treats any *.rs file in the benches directory as a benchmark, unless there are one or more [[bench]] sections in the Cargo.toml file. In that case, the auto-discovery is disabled entirely.
In Rust 2018 edition, Cargo will be changed so that [[bench]] no longer disables the auto-discovery.

That makes enough sense, but it also says

The first thing to do is update the Cargo.toml to disable the libtest benchmark harness

Which involves creating the "benches" section. I've done this, but now only the named file gets run.

Currently, I am taking the approach of creating a single bench file and using mod to import all the others. But this requires quite a lot of linking things together manually. The autodiscovery option would seem easier.

There is no fully automatic option available now. If you want to define multiple bench targets that use Criterion, you have to configure each one in Cargo.toml.

Thank you! I'v had gone the route of using multiple pulling everything into a single target using mod.

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.