rust/tests/source/chains.rs

44 lines
1.4 KiB
Rust
Raw Normal View History

2015-09-09 21:13:37 +00:00
// Test chain formatting.
fn main() {
2015-09-10 22:53:21 +00:00
// Don't put chains on a single line if it wasn't so in source.
let a = b .c
.d.1
.foo(|x| x + 1);
2015-09-09 21:13:37 +00:00
bbbbbbbbbbbbbbbbbbb.ccccccccccccccccccccccccccccccccccccc
.ddddddddddddddddddddddddddd();
bbbbbbbbbbbbbbbbbbb.ccccccccccccccccccccccccccccccccccccc.ddddddddddddddddddddddddddd.eeeeeeee();
2015-09-10 22:53:21 +00:00
// Test case where first chain element isn't a path, but is shorter than
// the size of a tab.
2015-09-09 21:13:37 +00:00
x()
.y(|| match cond() { true => (), false => () });
loong_func()
.quux(move || if true {
1
} else {
2
});
2015-09-09 21:14:09 +00:00
fffffffffffffffffffffffffffffffffff(a,
{
SCRIPT_TASK_ROOT
.with(|root| {
*root.borrow_mut() = Some(&script_task);
});
});
2015-09-09 21:13:37 +00:00
let suuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuum = xxxxxxx
.map(|x| x + 5)
.map(|x| x / 2)
.fold(0, |acc, x| acc + x);
aaaaaaaaaaaaaaaa.map(|x| {
x += 1;
x
}).filter(some_mod::some_filter)
}