blob: 4ca7f29b34cd085af07587e6b755a8ee3855dbef (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
#![warn(clippy::unused_async)]
use std::future::Future;
use std::pin::Pin;
async fn foo() -> i32 {
4
}
async fn bar() -> i32 {
foo().await
}
struct S;
impl S {
async fn unused(&self) -> i32 {
1
}
async fn used(&self) -> i32 {
self.unused().await
}
}
trait AsyncTrait {
fn trait_method() -> Pin<Box<dyn Future<Output = i32>>>;
}
macro_rules! async_trait_impl {
() => {
impl AsyncTrait for S {
fn trait_method() -> Pin<Box<dyn Future<Output = i32>>> {
async fn unused() -> i32 {
5
}
Box::pin(unused())
}
}
};
}
async_trait_impl!();
fn main() {
foo();
bar();
}
|