]> git.lizzy.rs Git - rust.git/blob - tests/ui/redundant_closure_call_fixable.rs
Don't cross contexts while building the suggestion for `redundant_closure_call`
[rust.git] / tests / ui / redundant_closure_call_fixable.rs
1 // run-rustfix
2
3 #![feature(async_closure)]
4 #![warn(clippy::redundant_closure_call)]
5 #![allow(unused)]
6
7 async fn something() -> u32 {
8     21
9 }
10
11 async fn something_else() -> u32 {
12     2
13 }
14
15 fn main() {
16     let a = (|| 42)();
17     let b = (async || {
18         let x = something().await;
19         let y = something_else().await;
20         x * y
21     })();
22     let c = (|| {
23         let x = 21;
24         let y = 2;
25         x * y
26     })();
27     let d = (async || something().await)();
28
29     macro_rules! m {
30         () => {
31             (|| 0)()
32         };
33     }
34     macro_rules! m2 {
35         () => {
36             (|| m!())()
37         };
38     }
39     m2!();
40 }