]> git.lizzy.rs Git - rust.git/blob - tests/target/configs/indent_style/block_call.rs
4e4c9465fe834a193084b9a39979545f6e291fe9
[rust.git] / tests / target / configs / indent_style / block_call.rs
1 // rustfmt-indent_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(
17         HttpsConnector::new(TlsClient::new()),
18     ));
19
20     // chain
21     let x = yooooooooooooo
22         .fooooooooooooooo
23         .baaaaaaaaaaaaar(hello, world);
24
25     // #1380
26     {
27         {
28             let creds = self.client
29                 .client_credentials(&self.config.auth.oauth2.id, &self.config.auth.oauth2.secret)?;
30         }
31     }
32
33     // nesting macro and function call
34     try!(foo(
35         xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx,
36         xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
37     ));
38     try!(foo(try!(
39         xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx,
40         xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
41     )));
42 }
43
44 // #1521
45 impl Foo {
46     fn map_pixel_to_coords(&self, point: &Vector2i, view: &View) -> Vector2f {
47         unsafe {
48             Vector2f::from_raw(ffi::sfRenderTexture_mapPixelToCoords(
49                 self.render_texture,
50                 point.raw(),
51                 view.raw(),
52             ))
53         }
54     }
55 }
56
57 fn issue1420() {
58     given(
59         r#"
60         # Getting started
61         ...
62     "#,
63     ).running(waltz)
64 }
65
66 // #1563
67 fn query(conn: &Connection) -> Result<()> {
68     conn.query_row(
69         r#"
70             SELECT title, date
71             FROM posts,
72             WHERE DATE(date) = $1
73         "#,
74         &[],
75         |row| Post {
76             title: row.get(0),
77             date: row.get(1),
78         },
79     )?;
80
81     Ok(())
82 }
83
84 // #1449
85 fn future_rayon_wait_1_thread() {
86     // run with only 1 worker thread; this would deadlock if we couldn't make progress
87     let mut result = None;
88     ThreadPool::new(Configuration::new().num_threads(1))
89         .unwrap()
90         .install(|| {
91             scope(|s| {
92                 use std::sync::mpsc::channel;
93                 let (tx, rx) = channel();
94                 let a = s.spawn_future(lazy(move || Ok::<usize, ()>(rx.recv().unwrap())));
95                 //                          ^^^^ FIXME: why is this needed?
96                 let b = s.spawn_future(a.map(|v| v + 1));
97                 let c = s.spawn_future(b.map(|v| v + 1));
98                 s.spawn(move |_| tx.send(20).unwrap());
99                 result = Some(c.rayon_wait().unwrap());
100             });
101         });
102     assert_eq!(result, Some(22));
103 }
104
105 // #1494
106 impl Cursor {
107     fn foo() {
108         self.cur_type()
109             .num_template_args()
110             .or_else(|| {
111                 let n: c_int = unsafe { clang_Cursor_getNumTemplateArguments(self.x) };
112
113                 if n >= 0 {
114                     Some(n as u32)
115                 } else {
116                     debug_assert_eq!(n, -1);
117                     None
118                 }
119             })
120             .or_else(|| {
121                 let canonical = self.canonical();
122                 if canonical != *self {
123                     canonical.num_template_args()
124                 } else {
125                     None
126                 }
127             });
128     }
129 }
130
131 fn issue1581() {
132     bootstrap.checks.register("PERSISTED_LOCATIONS", move || {
133         if locations2.0.inner_mut.lock().poisoned {
134             Check::new(
135                 State::Error,
136                 "Persisted location storage is poisoned due to a write failure",
137             )
138         } else {
139             Check::new(State::Healthy, "Persisted location storage is healthy")
140         }
141     });
142 }
143
144 fn issue1651() {
145     {
146         let type_list: Vec<_> =
147             try_opt!(types.iter().map(|ty| ty.rewrite(context, shape)).collect());
148     }
149 }