Closed
Description
Given the following code: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=ef06e37eae2f34c12c2143d48c9b4a0a
async fn hello() {
Ok(())
}
The current output is:
error[E0308]: mismatched types
--> src/lib.rs:2:5
|
2 | Ok(())
| ^^^^^^- help: consider using a semicolon here: `;`
| |
| expected `()`, found enum `Result`
|
= note: expected unit type `()`
found enum `Result<(), _>`
Ideally the output should look like:
error[E0308]: mismatched types
--> src/lib.rs:2:5
|
2 | Ok(())
| ^^^^^^ expected `()`, found enum `Result`
|
= note: expected unit type `()`
found enum `Result<(), _>`
help: consider using a semicolon here
|
2 | Ok(());
| +
help: try adding a return type
|
1 | async fn hello() -> Result<(), _> {
| ++++++++++++++++
Rust already suggests adding a return type when the function is not async
.