Skip to content

Mismatched Types #3538

Answered by memoryruins
JointKush asked this question in General
Feb 20, 2021 · 2 comments · 1 reply
Discussion options

You must be logged in to vote
async fn main() {

currently the return type is implicitly the unit type -> (). It's suggesting a semicolon because adding that after Ok(()) would cause the expression to return (), though not exactly what you seem to want (and the error is confusing because it's underlining the tokio::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 like async fn main() -> Result<(), Box<dyn std::error::Error>>

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@JointKush
Comment options

Answer selected by JointKush
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants