]> git.lizzy.rs Git - rust.git/blob - tests/ui/manual_async_fn.fixed
84c02bba4dcbfe64bfcfb14d91b94065316f1f42
[rust.git] / tests / ui / manual_async_fn.fixed
1 // run-rustfix
2 // edition:2018
3 #![warn(clippy::manual_async_fn)]
4 #![allow(unused)]
5
6 use std::future::Future;
7
8 async fn fut() -> i32 { 42 }
9
10 async fn empty_fut()  {}
11
12 async fn core_fut() -> i32 { 42 }
13
14 // should be ignored
15 fn has_other_stmts() -> impl core::future::Future<Output = i32> {
16     let _ = 42;
17     async move { 42 }
18 }
19
20 // should be ignored
21 fn not_fut() -> i32 {
22     42
23 }
24
25 // should be ignored
26 async fn already_async() -> impl Future<Output = i32> {
27     async { 42 }
28 }
29
30 struct S {}
31 impl S {
32     async fn inh_fut() -> i32 { 42 }
33
34     async fn meth_fut(&self) -> i32 { 42 }
35
36     async fn empty_fut(&self)  {}
37
38     // should be ignored
39     fn not_fut(&self) -> i32 {
40         42
41     }
42
43     // should be ignored
44     fn has_other_stmts() -> impl core::future::Future<Output = i32> {
45         let _ = 42;
46         async move { 42 }
47     }
48
49     // should be ignored
50     async fn already_async(&self) -> impl Future<Output = i32> {
51         async { 42 }
52     }
53 }
54
55 fn main() {}