Large Windows binaries for Rust/Cargo

When trying to deploy a Rust/Cargo project for Windows, I get binaries much larger then when building locally.

E.g. the primary .exe file (chrono-photo.exe) is 9.4MB, compared to 3.1MB for the local build.
I have no comparison for OSX and Linux binaries, as I didn’t set up these builds locally.

The issue arises for the .travis.yml in the commit linked below, and also for other repositories:

Is there anything I am missing, or any way to reduce binary size to what I get locally?

Many thanks in advance!

This is a relevant-looking tell (emphasis mine):

Finished test [unoptimized + debuginfo] target(s) in 2m 21s

Many thanks for the hint.

However, release builds (cargo build --release) go to folder target/release, where I take the binaries for deployment from. Builds for tests go to folder target/debug.

Also, changing the order to execute tests before the release build did not change the excutable’s size.

There is a much simpler repo with the same problem:
https://travis-ci.com/github/mlange-42/travis-test

Here, Travis builds for Windows are 3.5MB, while the local (release) build is 143kB! Local test builds are 146kB, which also shows that unoptimized can’t be the cause of the problem.

Thanks again!

Imprint