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