Mismatched Types #3538
-
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
async fn main() { currently the return type is implicitly the unit type Since you are trying to return a result and use |
Beta Was this translation helpful? Give feedback.
-
When the macro gives this kind of poor error message, you can remove the macro, and the error message should improve. |
Beta Was this translation helpful? Give feedback.
currently the return type is implicitly the unit type
-> ()
. It's suggesting a semicolon because adding that afterOk(())
would cause the expression to return()
, though not exactly what you seem to want (and the error is confusing because it's underlining thetokio::main
macro and not the expression).Since you are trying to return a result and use
?
, you likely meant to make the function's signature something likeasync fn main() -> Result<(), Box<dyn std::error::Error>>