summaryrefslogtreecommitdiffstats
path: root/src/tools/rustfmt/tests/target/issue-1681.rs
blob: 902765302eacb775ffe609de7ff7bd9839fc9d74 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// rustfmt-max_width: 80

// We would like to surround closure body with block when overflowing the last
// argument of function call if the last argument has condition and without
// block it may go multi lines.
fn foo() {
    refmut_map_result(self.cache.borrow_mut(), |cache| {
        match cache.entry(cache_key) {
            Occupied(entry) => Ok(entry.into_mut()),
            Vacant(entry) => {
                let statement = {
                    let sql = try!(entry.key().sql(source));
                    prepare_fn(&sql)
                };

                Ok(entry.insert(try!(statement)))
            }
        }
    })
    .map(MaybeCached::Cached)
}