]> git.lizzy.rs Git - rust.git/blob - tests/target/chains.rs
590f0a5b1569d9237fac7cb6a2bc3ace0b5a8383
[rust.git] / tests / target / chains.rs
1 // Test chain formatting.
2
3 fn main() {
4     // Don't put chains on a single line if it wasn't so in source.
5     let a = b.c
6              .d
7              .1
8              .foo(|x| x + 1);
9
10     bbbbbbbbbbbbbbbbbbb.ccccccccccccccccccccccccccccccccccccc.ddddddddddddddddddddddddddd();
11
12     bbbbbbbbbbbbbbbbbbb.ccccccccccccccccccccccccccccccccccccc
13                        .ddddddddddddddddddddddddddd
14                        .eeeeeeee();
15
16     // Test case where first chain element isn't a path, but is shorter than
17     // the size of a tab.
18     x().y(|| {
19         match cond() {
20             true => (),
21             false => (),
22         }
23     });
24
25     loong_func().quux(move || {
26         if true {
27             1
28         } else {
29             2
30         }
31     });
32
33     fffffffffffffffffffffffffffffffffff(a,
34                                         {
35                                             SCRIPT_TASK_ROOT.with(|root| {
36                                                 *root.borrow_mut() = Some(&script_task);
37                                             });
38                                         });
39
40     let suuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuum = xxxxxxx.map(|x| x + 5)
41                                                                           .map(|x| x / 2)
42                                                                           .fold(0,
43                                                                                 |acc, x| acc + x);
44
45     aaaaaaaaaaaaaaaa.map(|x| {
46                         x += 1;
47                         x
48                     })
49                     .filter(some_mod::some_filter)
50 }