The crazy thing is that rt.block_on does not seem to block, so if I removed the loop {}, the cargo tests terminates. Thus, for whatever reason, rt.block_on is returning.
I am trying to figure out how to catch this in the future.
Current thought process is: instead of writing
rt.block_on(async { foo() });
I should write
let x = rt.block_on(async { foo() });
then when IntelliJ does type inference, instead of () it shows impl ... Future, and it makes it blatantly obvious that I am getting back a future, rather than executing it.
Any other advice for capturing this? Maybe to explicitly write
let _ () = rt.block_on(...);
which generates a compile time error if it returns a future
warning: unused implementer of `Future` that must be used
--> src/lib.rs:22:5
|
22 | rt.block_on(async { foo() });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(unused_must_use)]` on by default
= note: futures do nothing unless you `.await` or poll them