I have come back to Rust after a long break. This time I tried to use unit testing as recommended, via cargo test.
I had to spend way too much time overcoming unexpected barriers put in my way at every step, like the program output being turned off (I mean, who would expect that?) and the backtrace not working without learning about, and setting, an obscure environment variable. I mean, really?? I think you could do a lot better than this in your drive for user friendliness.
Frankly, it is a lot more effective for me to debug manually with a few judicious print statements than having to cope with all this bull.
It is pretty common, not only in Rust, for test runners to capture output, so that you can at all times feed information to stdout that is then immediately shown in case a test breaks.
And RUST_BACKTRACE is literally advertised in the panic message when running without it. That's not very obscure.
This bugs me too. I'd like a persistable (e.g. in git) Cargo config option to (at e.g. the crate level, or even globally on a host) consistently turn on prints/logs written to stdout and stderr i.e. without filthy print-then-panic hacks.
The cargo test -- --nocapture command works but is onerous to remember and use each time.
I really mean it: I keep forgetting 1. that the command exists and 2. what in tarnation it actually is.
This is a little different, the reason for this I think is that backtraces are meant explicitly as a development tool i.e. not something a regular user should be exposed to. But this behavior is definitely different than you're probably used to coming from e.g. C/C++.
On a minor side note: I think it's really cool to see Rust being picked up by retirees (ok, retiree at this point)
Pro tip: Add export RUST_TEST_NOCAPTURE=1 to your shell profile to disable stdout capturing by default. You can unset the variable if you ever want to re-enable the default behavior. The environment variable is documented in the book and the rustc manpage.