fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
7.7 KiB211 linesraw
1error: this function can be simplified using the `async fn` syntax
2  --> $DIR/manual_async_fn.rs:6:1
3   |
4LL | fn fut() -> impl Future<Output = i32> {
5   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6   |
7   = note: `-D clippy::manual-async-fn` implied by `-D warnings`
8   = help: to override `-D warnings` add `#[allow(clippy::manual_async_fn)]`
9help: make the function `async` and return the output of the future directly
10   |
11LL | async fn fut() -> i32 {
12   | ~~~~~~~~~~~~~~~~~~~~~
13help: move the body of the async block to the enclosing function
14   |
15LL | fn fut() -> impl Future<Output = i32> { 42 }
16   |                                       ~~~~~~
17
18error: this function can be simplified using the `async fn` syntax
19  --> $DIR/manual_async_fn.rs:11:1
20   |
21LL | fn fut2() ->impl Future<Output = i32> {
22   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
23   |
24help: make the function `async` and return the output of the future directly
25   |
26LL | async fn fut2() -> i32 {
27   | ~~~~~~~~~~~~~~~~~~~~~~
28help: move the body of the async block to the enclosing function
29   |
30LL | fn fut2() ->impl Future<Output = i32> { 42 }
31   |                                       ~~~~~~
32
33error: this function can be simplified using the `async fn` syntax
34  --> $DIR/manual_async_fn.rs:16:1
35   |
36LL | fn fut3()-> impl Future<Output = i32> {
37   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
38   |
39help: make the function `async` and return the output of the future directly
40   |
41LL | async fn fut3() -> i32 {
42   | ~~~~~~~~~~~~~~~~~~~~~~
43help: move the body of the async block to the enclosing function
44   |
45LL | fn fut3()-> impl Future<Output = i32> { 42 }
46   |                                       ~~~~~~
47
48error: this function can be simplified using the `async fn` syntax
49  --> $DIR/manual_async_fn.rs:20:1
50   |
51LL | fn empty_fut() -> impl Future<Output = ()> {
52   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
53   |
54help: make the function `async` and remove the return type
55   |
56LL | async fn empty_fut() {
57   | ~~~~~~~~~~~~~~~~~~~~
58help: move the body of the async block to the enclosing function
59   |
60LL | fn empty_fut() -> impl Future<Output = ()> {}
61   |                                            ~~
62
63error: this function can be simplified using the `async fn` syntax
64  --> $DIR/manual_async_fn.rs:25:1
65   |
66LL | fn empty_fut2() ->impl Future<Output = ()> {
67   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
68   |
69help: make the function `async` and remove the return type
70   |
71LL | async fn empty_fut2() {
72   | ~~~~~~~~~~~~~~~~~~~~~
73help: move the body of the async block to the enclosing function
74   |
75LL | fn empty_fut2() ->impl Future<Output = ()> {}
76   |                                            ~~
77
78error: this function can be simplified using the `async fn` syntax
79  --> $DIR/manual_async_fn.rs:30:1
80   |
81LL | fn empty_fut3()-> impl Future<Output = ()> {
82   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
83   |
84help: make the function `async` and remove the return type
85   |
86LL | async fn empty_fut3() {
87   | ~~~~~~~~~~~~~~~~~~~~~
88help: move the body of the async block to the enclosing function
89   |
90LL | fn empty_fut3()-> impl Future<Output = ()> {}
91   |                                            ~~
92
93error: this function can be simplified using the `async fn` syntax
94  --> $DIR/manual_async_fn.rs:34:1
95   |
96LL | fn core_fut() -> impl core::future::Future<Output = i32> {
97   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
98   |
99help: make the function `async` and return the output of the future directly
100   |
101LL | async fn core_fut() -> i32 {
102   | ~~~~~~~~~~~~~~~~~~~~~~~~~~
103help: move the body of the async block to the enclosing function
104   |
105LL | fn core_fut() -> impl core::future::Future<Output = i32> { 42 }
106   |                                                          ~~~~~~
107
108error: this function can be simplified using the `async fn` syntax
109  --> $DIR/manual_async_fn.rs:56:5
110   |
111LL |     fn inh_fut() -> impl Future<Output = i32> {
112   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
113   |
114help: make the function `async` and return the output of the future directly
115   |
116LL |     async fn inh_fut() -> i32 {
117   |     ~~~~~~~~~~~~~~~~~~~~~~~~~
118help: move the body of the async block to the enclosing function
119   |
120LL ~     fn inh_fut() -> impl Future<Output = i32> {
121LL +         // NOTE: this code is here just to check that the indentation is correct in the suggested fix
122LL +         let a = 42;
123LL +         let b = 21;
124LL +         if a < b {
125LL +             let c = 21;
126LL +             let d = 42;
127LL +             if c < d {
128LL +                 let _ = 42;
129LL +             }
130LL +         }
131LL +         42
132LL +     }
133   |
134
135error: this function can be simplified using the `async fn` syntax
136  --> $DIR/manual_async_fn.rs:91:1
137   |
138LL | fn elided(_: &i32) -> impl Future<Output = i32> + '_ {
139   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
140   |
141help: make the function `async` and return the output of the future directly
142   |
143LL | async fn elided(_: &i32) -> i32 {
144   | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
145help: move the body of the async block to the enclosing function
146   |
147LL | fn elided(_: &i32) -> impl Future<Output = i32> + '_ { 42 }
148   |                                                      ~~~~~~
149
150error: this function can be simplified using the `async fn` syntax
151  --> $DIR/manual_async_fn.rs:100:1
152   |
153LL | fn explicit<'a, 'b>(_: &'a i32, _: &'b i32) -> impl Future<Output = i32> + 'a + 'b {
154   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
155   |
156help: make the function `async` and return the output of the future directly
157   |
158LL | async fn explicit<'a, 'b>(_: &'a i32, _: &'b i32) -> i32 {
159   | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
160help: move the body of the async block to the enclosing function
161   |
162LL | fn explicit<'a, 'b>(_: &'a i32, _: &'b i32) -> impl Future<Output = i32> + 'a + 'b { 42 }
163   |                                                                                    ~~~~~~
164
165error: this function can be simplified using the `async fn` syntax
166  --> $DIR/manual_async_fn.rs:129:1
167   |
168LL | pub fn issue_10450() -> impl Future<Output = i32> {
169   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
170   |
171help: make the function `async` and return the output of the future directly
172   |
173LL | pub async fn issue_10450() -> i32 {
174   | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
175help: move the body of the async block to the enclosing function
176   |
177LL | pub fn issue_10450() -> impl Future<Output = i32> { 42 }
178   |                                                   ~~~~~~
179
180error: this function can be simplified using the `async fn` syntax
181  --> $DIR/manual_async_fn.rs:133:1
182   |
183LL | pub(crate) fn issue_10450_2() -> impl Future<Output = i32> {
184   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
185   |
186help: make the function `async` and return the output of the future directly
187   |
188LL | pub(crate) async fn issue_10450_2() -> i32 {
189   | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
190help: move the body of the async block to the enclosing function
191   |
192LL | pub(crate) fn issue_10450_2() -> impl Future<Output = i32> { 42 }
193   |                                                            ~~~~~~
194
195error: this function can be simplified using the `async fn` syntax
196  --> $DIR/manual_async_fn.rs:137:1
197   |
198LL | pub(self) fn issue_10450_3() -> impl Future<Output = i32> {
199   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
200   |
201help: make the function `async` and return the output of the future directly
202   |
203LL | pub(self) async fn issue_10450_3() -> i32 {
204   | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
205help: move the body of the async block to the enclosing function
206   |
207LL | pub(self) fn issue_10450_3() -> impl Future<Output = i32> { 42 }
208   |                                                           ~~~~~~
209
210error: aborting due to 13 previous errors
211