This works great, but when I run clippy it warns me to remove the return statement, which I would typically do but in this case the compiler throws and thinks I am returning () when it should be String
mismatched types expected String, found ()
I guess because this is a macro. But who is wrong here? I think clippy is being a bit overzealous but maybe I am missing something. Seems like clippy should not be suggesting breaking the build.
Many blocks in Rust, including function bodies, evaluate to the value of their trailing expression, or () if there is no trailing expression. You have to remove the ; to turn the statement into a trailing expression.
Wow thanks. The semicolon indeed was the problem. I blindly followed the instructions to remove the return and left the semicolon. You can tell I am only in week 1 of rust
For future reference, it's a good idea to read warnings carefully and not only get the idea of what's going on - in this case, in particular, Clippy provided the exact replacement string, with both return and semicolon removed (and if this suggestion ends up misleading, that's actually a bug, and we'd like to know what to fix).