The problem is that mostly I don't want this (because I want to see the output of dbg!() calls), but sometimes I do want it (e.g., when deploying).
At the moment the solution I'm using is to comment it out or uncomment it.
But I'd rather not have the line in my code at all and instead have a run.bat and a rundb.bat, both calling cargo run --release ... but the former with the windows_subsytem="windows" attribute, and the latter without it.
The attribute you've posted is conditional and means something along the lines of: if built in release mode, use the windows subsystem. My question is, why are you manually testing in release mode? Why not simply use cargo run if you want to see your debug output, instead of cargo run --release?
Thanks. I tried it but it didn't work in cmd.exe on Win7 or Win10. Well actually it doesn't allow that syntax, but I tried:
SET SHOWCONSOLE=1
cargo run --release
correction That works great (now that I have done it correctly). So by default & for deploy I have no console on win; but when I want the console I just set the envvar.
One advantage of going the env variable route is that you can pass values to rustc-cfg. It also allows you to perform complex logic in your build script to enable/disable some other code/features.