2017-06-03 08:50:55 -05:00
|
|
|
// rustfmt-fn_call_style: Block
|
2017-06-05 01:31:44 -05:00
|
|
|
// rustfmt-combine_control_expr: false
|
2017-06-03 08:50:55 -05:00
|
|
|
// Combining openings and closings. See https://github.com/rust-lang-nursery/fmt-rfcs/issues/61.
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
// Call
|
|
|
|
foo(bar(
|
|
|
|
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
|
|
|
|
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
|
|
|
|
));
|
|
|
|
|
|
|
|
// Mac
|
|
|
|
foo(foo!(
|
|
|
|
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
|
|
|
|
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
|
|
|
|
));
|
|
|
|
|
|
|
|
// MethodCall
|
|
|
|
foo(x.foo::<Bar, Baz>(
|
|
|
|
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
|
|
|
|
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
|
|
|
|
));
|
|
|
|
|
|
|
|
// Block
|
|
|
|
foo!({
|
|
|
|
foo();
|
|
|
|
bar();
|
|
|
|
});
|
|
|
|
|
|
|
|
// Closure
|
|
|
|
foo(|x| {
|
|
|
|
let y = x + 1;
|
|
|
|
y
|
|
|
|
});
|
|
|
|
|
|
|
|
// Match
|
|
|
|
foo(match opt {
|
|
|
|
Some(x) => x,
|
|
|
|
None => y,
|
|
|
|
});
|
|
|
|
|
|
|
|
// Struct
|
|
|
|
foo(Bar {
|
|
|
|
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
|
|
|
|
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
|
|
|
|
});
|
|
|
|
|
|
|
|
// If
|
2017-06-05 01:31:44 -05:00
|
|
|
foo!(
|
|
|
|
if x {
|
|
|
|
foo();
|
|
|
|
} else {
|
|
|
|
bar();
|
|
|
|
}
|
|
|
|
);
|
2017-06-03 08:50:55 -05:00
|
|
|
|
|
|
|
// IfLet
|
2017-06-05 01:31:44 -05:00
|
|
|
foo!(
|
|
|
|
if let Some(..) = x {
|
|
|
|
foo();
|
|
|
|
} else {
|
|
|
|
bar();
|
|
|
|
}
|
|
|
|
);
|
2017-06-03 08:50:55 -05:00
|
|
|
|
|
|
|
// While
|
2017-06-05 01:31:44 -05:00
|
|
|
foo!(
|
|
|
|
while x {
|
|
|
|
foo();
|
|
|
|
bar();
|
|
|
|
}
|
|
|
|
);
|
2017-06-03 08:50:55 -05:00
|
|
|
|
|
|
|
// WhileLet
|
2017-06-05 01:31:44 -05:00
|
|
|
foo!(
|
|
|
|
while let Some(..) = x {
|
|
|
|
foo();
|
|
|
|
bar();
|
|
|
|
}
|
|
|
|
);
|
2017-06-03 08:50:55 -05:00
|
|
|
|
|
|
|
// ForLoop
|
2017-06-05 01:31:44 -05:00
|
|
|
foo!(
|
|
|
|
for x in y {
|
|
|
|
foo();
|
|
|
|
bar();
|
|
|
|
}
|
|
|
|
);
|
2017-06-03 08:50:55 -05:00
|
|
|
|
|
|
|
// Loop
|
2017-06-05 01:31:44 -05:00
|
|
|
foo!(
|
|
|
|
loop {
|
|
|
|
foo();
|
|
|
|
bar();
|
|
|
|
}
|
|
|
|
);
|
2017-06-03 08:50:55 -05:00
|
|
|
|
|
|
|
// Tuple
|
|
|
|
foo((
|
|
|
|
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
|
|
|
|
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
|
|
|
|
));
|
|
|
|
|
|
|
|
// AddrOf
|
|
|
|
foo(&bar(
|
|
|
|
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
|
|
|
|
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
|
|
|
|
));
|
|
|
|
|
|
|
|
// Box
|
|
|
|
foo(box Bar {
|
|
|
|
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
|
|
|
|
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
|
|
|
|
});
|
|
|
|
|
|
|
|
// Unary
|
|
|
|
foo(!bar(
|
|
|
|
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
|
|
|
|
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
|
|
|
|
));
|
|
|
|
|
|
|
|
// Try
|
|
|
|
foo(bar(
|
|
|
|
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
|
|
|
|
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb,
|
|
|
|
)?);
|
|
|
|
|
|
|
|
// Cast
|
|
|
|
foo(Bar {
|
|
|
|
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx,
|
|
|
|
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx,
|
|
|
|
} as i64);
|
|
|
|
}
|