2019-06-19 15:55:18 -05:00
|
|
|
// edition:2018
|
|
|
|
|
|
|
|
fn take_u32(_x: u32) {}
|
|
|
|
|
|
|
|
async fn make_u32() -> u32 {
|
|
|
|
22
|
|
|
|
}
|
|
|
|
|
|
|
|
#[allow(unused)]
|
|
|
|
async fn suggest_await_in_async_fn() {
|
|
|
|
let x = make_u32();
|
|
|
|
take_u32(x)
|
|
|
|
//~^ ERROR mismatched types [E0308]
|
2020-10-21 16:25:09 -05:00
|
|
|
//~| HELP consider `await`ing on the `Future`
|
|
|
|
//~| SUGGESTION .await
|
2019-06-19 15:55:18 -05:00
|
|
|
}
|
|
|
|
|
2019-12-03 19:32:50 -06:00
|
|
|
async fn dummy() {}
|
|
|
|
|
|
|
|
#[allow(unused)]
|
|
|
|
async fn suggest_await_in_async_fn_return() {
|
|
|
|
dummy()
|
|
|
|
//~^ ERROR mismatched types [E0308]
|
2020-10-21 16:25:09 -05:00
|
|
|
//~| HELP consider `await`ing on the `Future`
|
2022-02-17 07:28:06 -06:00
|
|
|
//~| HELP consider using a semicolon here
|
2020-10-21 16:25:09 -05:00
|
|
|
//~| SUGGESTION .await
|
2019-12-03 19:32:50 -06:00
|
|
|
}
|
|
|
|
|
2021-11-16 00:51:20 -06:00
|
|
|
#[allow(unused)]
|
|
|
|
async fn suggest_await_on_if() {
|
|
|
|
let _x = if true {
|
|
|
|
dummy()
|
|
|
|
//~^ HELP consider `await`ing on the `Future`
|
|
|
|
} else {
|
|
|
|
dummy().await
|
|
|
|
//~^ ERROR `if` and `else` have incompatible types [E0308]
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#[allow(unused)]
|
|
|
|
async fn suggest_await_on_previous_match_arms() {
|
|
|
|
let _x = match 0usize {
|
|
|
|
0 => dummy(), //~ HELP consider `await`ing on the `Future`
|
|
|
|
1 => dummy(),
|
|
|
|
2 => dummy().await,
|
|
|
|
//~^ `match` arms have incompatible types [E0308]
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#[allow(unused)]
|
|
|
|
async fn suggest_await_on_match_expr() {
|
|
|
|
let _x = match dummy() { //~ HELP consider `await`ing on the `Future`
|
|
|
|
() => {} //~ ERROR mismatched types [E0308]
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2021-11-17 23:38:04 -06:00
|
|
|
async fn dummy_result() -> Result<(), ()> {
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
|
|
|
#[allow(unused)]
|
|
|
|
async fn suggest_await_in_generic_pattern() {
|
|
|
|
match dummy_result() {
|
|
|
|
//~^ HELP consider `await`ing on the `Future`
|
|
|
|
//~| HELP consider `await`ing on the `Future`
|
|
|
|
//~| SUGGESTION .await
|
|
|
|
Ok(_) => {}
|
|
|
|
//~^ ERROR mismatched types [E0308]
|
|
|
|
Err(_) => {}
|
|
|
|
//~^ ERROR mismatched types [E0308]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-06-19 15:55:18 -05:00
|
|
|
fn main() {}
|