summaryrefslogtreecommitdiffstats
path: root/src/tools/rustfmt/tests/target/configs/indent_style/block_call.rs
blob: 19c44dc019a264b1a384786b0eaf720c32953f87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
// rustfmt-indent_style: Block
// Function call style

fn main() {
    lorem(
        "lorem",
        "ipsum",
        "dolor",
        "sit",
        "amet",
        "consectetur",
        "adipiscing",
        "elit",
    );
    // #1501
    let hyper = Arc::new(Client::with_connector(
        HttpsConnector::new(TlsClient::new()),
    ));

    // chain
    let x = yooooooooooooo
        .fooooooooooooooo
        .baaaaaaaaaaaaar(hello, world);

    // #1380
    {
        {
            let creds = self
                .client
                .client_credentials(&self.config.auth.oauth2.id, &self.config.auth.oauth2.secret)?;
        }
    }

    // nesting macro and function call
    try!(foo(
        xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx,
        xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    ));
    try!(foo(try!(
        xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx,
        xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    )));
}

// #1521
impl Foo {
    fn map_pixel_to_coords(&self, point: &Vector2i, view: &View) -> Vector2f {
        unsafe {
            Vector2f::from_raw(ffi::sfRenderTexture_mapPixelToCoords(
                self.render_texture,
                point.raw(),
                view.raw(),
            ))
        }
    }
}

fn issue1420() {
    given(
        r#"
        # Getting started
        ...
    "#,
    )
    .running(waltz)
}

// #1563
fn query(conn: &Connection) -> Result<()> {
    conn.query_row(
        r#"
            SELECT title, date
            FROM posts,
            WHERE DATE(date) = $1
        "#,
        &[],
        |row| Post {
            title: row.get(0),
            date: row.get(1),
        },
    )?;

    Ok(())
}

// #1449
fn future_rayon_wait_1_thread() {
    // run with only 1 worker thread; this would deadlock if we couldn't make progress
    let mut result = None;
    ThreadPool::new(Configuration::new().num_threads(1))
        .unwrap()
        .install(|| {
            scope(|s| {
                use std::sync::mpsc::channel;
                let (tx, rx) = channel();
                let a = s.spawn_future(lazy(move || Ok::<usize, ()>(rx.recv().unwrap())));
                //                          ^^^^ FIXME: why is this needed?
                let b = s.spawn_future(a.map(|v| v + 1));
                let c = s.spawn_future(b.map(|v| v + 1));
                s.spawn(move |_| tx.send(20).unwrap());
                result = Some(c.rayon_wait().unwrap());
            });
        });
    assert_eq!(result, Some(22));
}

// #1494
impl Cursor {
    fn foo() {
        self.cur_type()
            .num_template_args()
            .or_else(|| {
                let n: c_int = unsafe { clang_Cursor_getNumTemplateArguments(self.x) };

                if n >= 0 {
                    Some(n as u32)
                } else {
                    debug_assert_eq!(n, -1);
                    None
                }
            })
            .or_else(|| {
                let canonical = self.canonical();
                if canonical != *self {
                    canonical.num_template_args()
                } else {
                    None
                }
            });
    }
}

fn issue1581() {
    bootstrap.checks.register("PERSISTED_LOCATIONS", move || {
        if locations2.0.inner_mut.lock().poisoned {
            Check::new(
                State::Error,
                "Persisted location storage is poisoned due to a write failure",
            )
        } else {
            Check::new(State::Healthy, "Persisted location storage is healthy")
        }
    });
}

fn issue1651() {
    {
        let type_list: Vec<_> =
            try_opt!(types.iter().map(|ty| ty.rewrite(context, shape)).collect());
    }
}