mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 15:14:29 +00:00
Add a test for an async function.
This commit is contained in:
parent
4972989b61
commit
c1d2b9376a
3 changed files with 20 additions and 6 deletions
|
@ -22,6 +22,12 @@ fn custom_future_type_ctor() -> CustomFutureType {
|
|||
CustomFutureType
|
||||
}
|
||||
|
||||
async fn f() -> CustomFutureType {
|
||||
// Don't warn for functions since you have to explicitly declare their
|
||||
// return types.
|
||||
CustomFutureType
|
||||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
fn main() {
|
||||
let _f = {
|
||||
|
@ -58,4 +64,5 @@ fn main() {
|
|||
CustomFutureType.await
|
||||
};
|
||||
let _n = async || custom_future_type_ctor();
|
||||
let _o = async || f();
|
||||
}
|
||||
|
|
|
@ -22,6 +22,12 @@ fn custom_future_type_ctor() -> CustomFutureType {
|
|||
CustomFutureType
|
||||
}
|
||||
|
||||
async fn f() -> CustomFutureType {
|
||||
// Don't warn for functions since you have to explicitly declare their
|
||||
// return types.
|
||||
CustomFutureType
|
||||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
fn main() {
|
||||
let _f = {
|
||||
|
@ -58,4 +64,5 @@ fn main() {
|
|||
CustomFutureType
|
||||
};
|
||||
let _n = async || custom_future_type_ctor();
|
||||
let _o = async || f();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: an async construct yields a type which is itself awaitable
|
||||
--> $DIR/async_yields_async.rs:34:9
|
||||
--> $DIR/async_yields_async.rs:40:9
|
||||
|
|
||||
LL | let _h = async {
|
||||
| ____________________-
|
||||
|
@ -20,7 +20,7 @@ LL | }.await
|
|||
|
|
||||
|
||||
error: an async construct yields a type which is itself awaitable
|
||||
--> $DIR/async_yields_async.rs:39:9
|
||||
--> $DIR/async_yields_async.rs:45:9
|
||||
|
|
||||
LL | let _i = async {
|
||||
| ____________________-
|
||||
|
@ -33,7 +33,7 @@ LL | | };
|
|||
| |_____- outer async construct
|
||||
|
||||
error: an async construct yields a type which is itself awaitable
|
||||
--> $DIR/async_yields_async.rs:45:9
|
||||
--> $DIR/async_yields_async.rs:51:9
|
||||
|
|
||||
LL | let _j = async || {
|
||||
| _______________________-
|
||||
|
@ -53,7 +53,7 @@ LL | }.await
|
|||
|
|
||||
|
||||
error: an async construct yields a type which is itself awaitable
|
||||
--> $DIR/async_yields_async.rs:50:9
|
||||
--> $DIR/async_yields_async.rs:56:9
|
||||
|
|
||||
LL | let _k = async || {
|
||||
| _______________________-
|
||||
|
@ -66,7 +66,7 @@ LL | | };
|
|||
| |_____- outer async construct
|
||||
|
||||
error: an async construct yields a type which is itself awaitable
|
||||
--> $DIR/async_yields_async.rs:52:23
|
||||
--> $DIR/async_yields_async.rs:58:23
|
||||
|
|
||||
LL | let _l = async || CustomFutureType;
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
@ -76,7 +76,7 @@ LL | let _l = async || CustomFutureType;
|
|||
| help: consider awaiting this value: `CustomFutureType.await`
|
||||
|
||||
error: an async construct yields a type which is itself awaitable
|
||||
--> $DIR/async_yields_async.rs:58:9
|
||||
--> $DIR/async_yields_async.rs:64:9
|
||||
|
|
||||
LL | let _m = async || {
|
||||
| _______________________-
|
||||
|
|
Loading…
Reference in a new issue