]> git.lizzy.rs Git - rust.git/blob - tests/target/configs-fn_call_style-block.rs
Move Indent and Shape to shape.rs from lib.rs
[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(
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| {
76             Post {
77                 title: row.get(0),
78                 date: row.get(1),
79             }
80         },
81     )?;
82
83     Ok(())
84 }
85
86 // #1449
87 fn future_rayon_wait_1_thread() {
88     // run with only 1 worker thread; this would deadlock if we couldn't make progress
89     let mut result = None;
90     ThreadPool::new(Configuration::new().num_threads(1))
91         .unwrap()
92         .install(|| {
93             scope(|s| {
94                 use std::sync::mpsc::channel;
95                 let (tx, rx) = channel();
96                 let a = s.spawn_future(lazy(move || Ok::<usize, ()>(rx.recv().unwrap())));
97                 //                          ^^^^ FIXME: why is this needed?
98                 let b = s.spawn_future(a.map(|v| v + 1));
99                 let c = s.spawn_future(b.map(|v| v + 1));
100                 s.spawn(move |_| tx.send(20).unwrap());
101                 result = Some(c.rayon_wait().unwrap());
102             });
103         });
104     assert_eq!(result, Some(22));
105 }
106
107 // #1494
108 impl Cursor {
109     fn foo() {
110         self.cur_type()
111             .num_template_args()
112             .or_else(|| {
113                 let n: c_int = unsafe { clang_Cursor_getNumTemplateArguments(self.x) };
114
115                 if n >= 0 {
116                     Some(n as u32)
117                 } else {
118                     debug_assert_eq!(n, -1);
119                     None
120                 }
121             })
122             .or_else(|| {
123                 let canonical = self.canonical();
124                 if canonical != *self {
125                     canonical.num_template_args()
126                 } else {
127                     None
128                 }
129             });
130     }
131 }
132
133 fn issue1581() {
134     bootstrap.checks.register("PERSISTED_LOCATIONS", move || {
135         if locations2.0.inner_mut.lock().poisoned {
136             Check::new(
137                 State::Error,
138                 "Persisted location storage is poisoned due to a write failure",
139             )
140         } else {
141             Check::new(State::Healthy, "Persisted location storage is healthy")
142         }
143     });
144 }
145
146 fn issue1651() {
147     {
148         let type_list: Vec<_> =
149             try_opt!(types.iter().map(|ty| ty.rewrite(context, shape)).collect());
150     }
151 }