Closed mgumbley-resilient closed 3 months ago
A function that has "no return" really does just return ()
. And when you write your expectations, you really do need to do .return_const(())
. But as the error message says, you can leave that part out if you enable the "nightly" feature. The specific nightly compiler feature that we need is Specialization, and unfortunately that one looks a long way from stabilization.
Thank you Alan.
Hi, thank you for mockall - I'm trying to assert that a method in a trait that has no return type is being called:
When I run this, I have a panic with:
I'm not using "nightly" - and am not actually returning anything: the function is called for its side-effects.
I can work around this by making the start method return unit (
-> ()
) and in my test, usething.expect_start().once().return_const(());
but it's a little messy. Could this case be simplified?