cargo test --release uses the bench profile.
If you want it to share artifacts with cargo build --release, then you must make sure that the bench profile and release profile have the exact same compilation options.
cargo test --release uses the bench profile.
If you want it to share artifacts with cargo build --release, then you must make sure that the bench profile and release profile have the exact same compilation options.