2015-09-09 16:13:37 -05:00
|
|
|
// Test chain formatting.
|
|
|
|
|
|
|
|
fn main() {
|
2015-09-10 17:53:21 -05:00
|
|
|
// Don't put chains on a single line if it wasn't so in source.
|
2015-09-09 16:17:31 -05:00
|
|
|
let a = b.c
|
2016-04-22 02:03:36 -05:00
|
|
|
.d
|
|
|
|
.1
|
|
|
|
.foo(|x| x + 1);
|
2015-09-09 16:13:37 -05:00
|
|
|
|
2015-10-23 13:36:38 -05:00
|
|
|
bbbbbbbbbbbbbbbbbbb.ccccccccccccccccccccccccccccccccccccc
|
2016-04-22 02:03:36 -05:00
|
|
|
.ddddddddddddddddddddddddddd();
|
2015-09-09 16:13:37 -05:00
|
|
|
|
|
|
|
bbbbbbbbbbbbbbbbbbb.ccccccccccccccccccccccccccccccccccccc
|
2016-04-22 02:03:36 -05:00
|
|
|
.ddddddddddddddddddddddddddd
|
|
|
|
.eeeeeeee();
|
2015-09-09 16:13:37 -05:00
|
|
|
|
2015-09-10 17:53:21 -05:00
|
|
|
// Test case where first chain element isn't a path, but is shorter than
|
|
|
|
// the size of a tab.
|
2016-04-13 15:36:59 -05:00
|
|
|
x().y(|| match cond() {
|
|
|
|
true => (),
|
|
|
|
false => (),
|
2015-09-09 16:17:31 -05:00
|
|
|
});
|
|
|
|
|
2016-04-13 15:36:59 -05:00
|
|
|
loong_func().quux(move || if true {
|
|
|
|
1
|
|
|
|
} else {
|
|
|
|
2
|
2015-09-09 16:17:31 -05:00
|
|
|
});
|
2015-09-09 16:13:37 -05:00
|
|
|
|
2015-10-08 16:07:19 -05:00
|
|
|
some_fuuuuuuuuunction().method_call_a(aaaaa, bbbbb, |c| {
|
|
|
|
let x = c;
|
|
|
|
x
|
|
|
|
});
|
|
|
|
|
|
|
|
some_fuuuuuuuuunction()
|
|
|
|
.method_call_a(aaaaa, bbbbb, |c| {
|
|
|
|
let x = c;
|
|
|
|
x
|
|
|
|
})
|
|
|
|
.method_call_b(aaaaa, bbbbb, |c| {
|
|
|
|
let x = c;
|
|
|
|
x
|
|
|
|
});
|
|
|
|
|
|
|
|
fffffffffffffffffffffffffffffffffff(a, {
|
|
|
|
SCRIPT_TASK_ROOT.with(|root| {
|
|
|
|
*root.borrow_mut() = Some(&script_task);
|
|
|
|
});
|
|
|
|
});
|
2015-09-09 16:14:09 -05:00
|
|
|
|
2015-09-09 16:13:37 -05:00
|
|
|
let suuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuum = xxxxxxx.map(|x| x + 5)
|
2016-04-22 02:03:36 -05:00
|
|
|
.map(|x| x / 2)
|
|
|
|
.fold(0, |acc, x| acc + x);
|
2015-09-09 16:14:54 -05:00
|
|
|
|
|
|
|
aaaaaaaaaaaaaaaa.map(|x| {
|
2016-04-22 02:03:36 -05:00
|
|
|
x += 1;
|
|
|
|
x
|
|
|
|
})
|
|
|
|
.filter(some_mod::some_filter)
|
2015-09-09 16:13:37 -05:00
|
|
|
}
|
2015-10-18 10:56:13 -05:00
|
|
|
|
|
|
|
fn floaters() {
|
|
|
|
let z = Foo {
|
|
|
|
field1: val1,
|
|
|
|
field2: val2,
|
|
|
|
};
|
|
|
|
|
|
|
|
let x = Foo {
|
2016-04-22 02:03:36 -05:00
|
|
|
field1: val1,
|
|
|
|
field2: val2,
|
|
|
|
}
|
|
|
|
.method_call()
|
|
|
|
.method_call();
|
2015-10-18 10:56:13 -05:00
|
|
|
|
|
|
|
let y = if cond {
|
2016-04-22 02:03:36 -05:00
|
|
|
val1
|
|
|
|
} else {
|
|
|
|
val2
|
|
|
|
}
|
|
|
|
.method_call();
|
2015-10-18 10:56:13 -05:00
|
|
|
|
|
|
|
{
|
|
|
|
match x {
|
|
|
|
PushParam => {
|
|
|
|
// params are 1-indexed
|
|
|
|
stack.push(mparams[match cur.to_digit(10) {
|
2016-04-22 02:03:36 -05:00
|
|
|
Some(d) => d as usize - 1,
|
|
|
|
None => return Err("bad param number".to_owned()),
|
|
|
|
}]
|
|
|
|
.clone());
|
2015-10-18 10:56:13 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if cond {
|
2016-04-22 02:03:36 -05:00
|
|
|
some();
|
|
|
|
} else {
|
|
|
|
none();
|
|
|
|
}
|
|
|
|
.bar()
|
|
|
|
.baz();
|
2015-10-18 10:56:13 -05:00
|
|
|
|
|
|
|
Foo { x: val }
|
|
|
|
.baz(|| {
|
|
|
|
// force multiline
|
|
|
|
})
|
|
|
|
.quux();
|
|
|
|
|
|
|
|
Foo {
|
2016-04-22 02:03:36 -05:00
|
|
|
y: i_am_multi_line,
|
|
|
|
z: ok,
|
|
|
|
}
|
|
|
|
.baz(|| {
|
|
|
|
// force multiline
|
|
|
|
})
|
|
|
|
.quux();
|
2015-10-18 10:56:13 -05:00
|
|
|
|
|
|
|
a +
|
|
|
|
match x {
|
2016-04-22 02:03:36 -05:00
|
|
|
true => "yay!",
|
|
|
|
false => "boo!",
|
|
|
|
}
|
|
|
|
.bar()
|
2015-10-18 10:56:13 -05:00
|
|
|
}
|
2015-10-23 13:36:38 -05:00
|
|
|
|
|
|
|
fn is_replaced_content() -> bool {
|
|
|
|
constellat.send(ConstellationMsg::ViewportConstrained(self.id, constraints))
|
2016-04-22 02:03:36 -05:00
|
|
|
.unwrap();
|
2015-10-23 13:36:38 -05:00
|
|
|
}
|
2015-11-13 07:53:34 -06:00
|
|
|
|
|
|
|
fn issue587() {
|
|
|
|
a.b::<()>(c);
|
|
|
|
|
|
|
|
std::mem::transmute(dl.symbol::<()>("init").unwrap())
|
|
|
|
}
|
2016-05-09 13:07:59 -05:00
|
|
|
|
|
|
|
fn try_shorthand() {
|
|
|
|
let x = expr?;
|
|
|
|
let y = expr.kaas()?.test();
|
|
|
|
let loooooooooooooooooooooooooooooooooooooooooong = does_this?
|
|
|
|
.look?
|
|
|
|
.good?
|
|
|
|
.should_we_break?
|
|
|
|
.after_the_first_question_mark?;
|
|
|
|
let yyyy = expr?.another?.another?.another?.another?.another?.another?.another?.another?.test();
|
|
|
|
let zzzz = expr?.another?.another?.another?.another?;
|
|
|
|
let aaa = x??????????????????????????????????????????????????????????????????????????;
|
|
|
|
}
|