]> git.lizzy.rs Git - rust.git/blob - tests/target/configs-fn_call_style-block.rs
Update tests
[rust.git] / tests / target / configs-fn_call_style-block.rs
1 // rustfmt-fn_call_style: Block
2 // Function call style
3
4 fn main() {
5     lorem(
6         "lorem",
7         "ipsum",
8         "dolor",
9         "sit",
10         "amet",
11         "consectetur",
12         "adipiscing",
13         "elit",
14     );
15     // #1501
16     let hyper = Arc::new(Client::with_connector(HttpsConnector::new(
17         TlsClient::new(),
18     )));
19 }
20
21 // #1521
22 impl Foo {
23     fn map_pixel_to_coords(&self, point: &Vector2i, view: &View) -> Vector2f {
24         unsafe {
25             Vector2f::from_raw(ffi::sfRenderTexture_mapPixelToCoords(
26                 self.render_texture,
27                 point.raw(),
28                 view.raw(),
29             ))
30         }
31     }
32 }
33
34 fn issue1420() {
35     given(
36         r#"
37         # Getting started
38         ...
39     "#
40     )
41         .running(waltz)
42 }
43
44 // #1563
45 fn query(conn: &Connection) -> Result<()> {
46     conn.query_row(
47         r#"
48             SELECT title, date
49             FROM posts,
50             WHERE DATE(date) = $1
51         "#,
52         &[],
53         |row| {
54             Post {
55                 title: row.get(0),
56                 date: row.get(1),
57             }
58         },
59     )?;
60
61     Ok(())
62 }
63
64 // #1449
65 fn future_rayon_wait_1_thread() {
66     // run with only 1 worker thread; this would deadlock if we couldn't make progress
67     let mut result = None;
68     ThreadPool::new(Configuration::new().num_threads(1))
69         .unwrap()
70         .install(|| {
71             scope(|s| {
72                 use std::sync::mpsc::channel;
73                 let (tx, rx) = channel();
74                 let a = s.spawn_future(lazy(move || Ok::<usize, ()>(rx.recv().unwrap())));
75                 //                          ^^^^ FIXME: why is this needed?
76                 let b = s.spawn_future(a.map(|v| v + 1));
77                 let c = s.spawn_future(b.map(|v| v + 1));
78                 s.spawn(move |_| tx.send(20).unwrap());
79                 result = Some(c.rayon_wait().unwrap());
80             });
81         });
82     assert_eq!(result, Some(22));
83 }
84
85 // #1494
86 impl Cursor {
87     fn foo() {
88         self.cur_type()
89             .num_template_args()
90             .or_else(|| {
91                 let n: c_int = unsafe { clang_Cursor_getNumTemplateArguments(self.x) };
92
93                 if n >= 0 {
94                     Some(n as u32)
95                 } else {
96                     debug_assert_eq!(n, -1);
97                     None
98                 }
99             })
100             .or_else(|| {
101                 let canonical = self.canonical();
102                 if canonical != *self {
103                     canonical.num_template_args()
104                 } else {
105                     None
106                 }
107             });
108     }
109 }