How to exclude main binary from benchmark?

Hello. When i trying to benchmark (cargo bench) cargo build main binary in release, i only want to build benchmark in benches folder. How to exclude main bin?

It's not possible to do within a single crate. Cargo assumes you may need binaries in your "tests", and benches are compiled as a kind of a test.

You have to split your crate into a library-only crate and a separate binary-only crate that uses the library one.

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.