2017-03-19 16:25:37 -05:00
|
|
|
// rustfmt-array_layout: Block
|
2017-03-27 16:43:46 -05:00
|
|
|
// rustfmt-fn_call_style: Block
|
2017-03-19 16:25:37 -05:00
|
|
|
// Test expressions with block formatting.
|
|
|
|
|
|
|
|
fn arrays() {
|
|
|
|
[];
|
|
|
|
let empty = [];
|
|
|
|
|
2017-04-05 20:06:11 -05:00
|
|
|
let foo = [a_long_name, a_very_lng_name, a_long_name];
|
2017-03-19 16:25:37 -05:00
|
|
|
|
|
|
|
let foo = [
|
|
|
|
a_long_name,
|
|
|
|
a_very_lng_name,
|
|
|
|
a_long_name,
|
|
|
|
a_very_lng_name,
|
|
|
|
a_long_name,
|
|
|
|
a_very_lng_name,
|
|
|
|
a_long_name,
|
|
|
|
a_very_lng_name,
|
|
|
|
];
|
|
|
|
|
|
|
|
vec![
|
|
|
|
a_long_name,
|
|
|
|
a_very_lng_name,
|
|
|
|
a_long_name,
|
|
|
|
a_very_lng_name,
|
|
|
|
a_long_name,
|
|
|
|
a_very_lng_name,
|
|
|
|
a_very_lng_name,
|
|
|
|
];
|
|
|
|
|
|
|
|
[
|
|
|
|
a_long_name,
|
|
|
|
a_very_lng_name,
|
|
|
|
a_long_name,
|
|
|
|
a_very_lng_name,
|
|
|
|
a_long_name,
|
|
|
|
a_very_lng_name,
|
|
|
|
a_very_lng_name,
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
fn arrays() {
|
|
|
|
let x = [
|
|
|
|
0,
|
|
|
|
1,
|
|
|
|
2,
|
|
|
|
3,
|
|
|
|
4,
|
|
|
|
5,
|
|
|
|
6,
|
|
|
|
7,
|
|
|
|
8,
|
|
|
|
9,
|
|
|
|
0,
|
|
|
|
1,
|
|
|
|
2,
|
|
|
|
3,
|
|
|
|
4,
|
|
|
|
5,
|
|
|
|
6,
|
|
|
|
7,
|
|
|
|
8,
|
|
|
|
9,
|
|
|
|
0,
|
|
|
|
7,
|
|
|
|
8,
|
|
|
|
9,
|
|
|
|
0,
|
|
|
|
1,
|
|
|
|
2,
|
|
|
|
3,
|
|
|
|
4,
|
|
|
|
5,
|
|
|
|
6,
|
|
|
|
7,
|
|
|
|
8,
|
|
|
|
9,
|
|
|
|
0,
|
|
|
|
];
|
|
|
|
|
|
|
|
let y = [
|
|
|
|
/* comment */
|
|
|
|
1,
|
|
|
|
2, /* post comment */
|
|
|
|
3,
|
|
|
|
];
|
|
|
|
|
|
|
|
let xy = [
|
|
|
|
strukt {
|
|
|
|
test123: value_one_two_three_four,
|
|
|
|
turbo: coolio(),
|
|
|
|
},
|
|
|
|
/* comment */
|
|
|
|
1,
|
|
|
|
];
|
|
|
|
|
2017-03-27 16:43:46 -05:00
|
|
|
let a = WeightedChoice::new(
|
|
|
|
&mut [
|
|
|
|
Weighted { weight: x, item: 0 },
|
|
|
|
Weighted { weight: 1, item: 1 },
|
|
|
|
Weighted { weight: x, item: 2 },
|
|
|
|
Weighted { weight: 1, item: 3 },
|
|
|
|
],
|
|
|
|
);
|
2017-03-19 16:25:37 -05:00
|
|
|
|
2017-04-05 20:06:11 -05:00
|
|
|
let z = [
|
|
|
|
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx,
|
|
|
|
yyyyyyyyyyyyyyyyyyyyyyyyyyy,
|
|
|
|
zzzzzzzzzzzzzzzzz,
|
|
|
|
q,
|
|
|
|
];
|
2017-03-19 16:25:37 -05:00
|
|
|
|
|
|
|
[1 + 3, 4, 5, 6, 7, 7, fncall::<Vec<_>>(3 - 1)]
|
|
|
|
}
|
2017-03-27 16:43:46 -05:00
|
|
|
|
|
|
|
fn function_calls() {
|
|
|
|
let items = itemize_list(
|
|
|
|
context.codemap,
|
|
|
|
args.iter(),
|
|
|
|
")",
|
|
|
|
|item| item.span.lo,
|
|
|
|
|item| item.span.hi,
|
|
|
|
|item| {
|
|
|
|
item.rewrite(
|
|
|
|
context,
|
|
|
|
Shape {
|
|
|
|
width: remaining_width,
|
|
|
|
..nested_shape
|
|
|
|
},
|
|
|
|
)
|
|
|
|
},
|
|
|
|
span.lo,
|
|
|
|
span.hi,
|
|
|
|
);
|
|
|
|
|
|
|
|
itemize_list(
|
|
|
|
context.codemap,
|
|
|
|
args.iter(),
|
|
|
|
")",
|
|
|
|
|item| item.span.lo,
|
|
|
|
|item| item.span.hi,
|
|
|
|
|item| {
|
|
|
|
item.rewrite(
|
|
|
|
context,
|
|
|
|
Shape {
|
|
|
|
width: remaining_width,
|
|
|
|
..nested_shape
|
|
|
|
},
|
|
|
|
)
|
|
|
|
},
|
|
|
|
span.lo,
|
|
|
|
span.hi,
|
|
|
|
)
|
|
|
|
}
|
2017-04-03 17:15:11 -05:00
|
|
|
|
|
|
|
fn macros() {
|
|
|
|
baz!(
|
|
|
|
do_not,
|
|
|
|
add,
|
|
|
|
trailing,
|
|
|
|
commas,
|
|
|
|
inside,
|
|
|
|
of,
|
|
|
|
function,
|
|
|
|
like,
|
|
|
|
macros,
|
|
|
|
even,
|
|
|
|
if_they,
|
|
|
|
are,
|
|
|
|
long
|
|
|
|
);
|
|
|
|
|
|
|
|
baz!(one_item_macro_which_is_also_loooooooooooooooooooooooooooooooooooooooooooooooong);
|
|
|
|
|
|
|
|
let _ = match option {
|
|
|
|
None => {
|
|
|
|
baz!(
|
|
|
|
function,
|
|
|
|
like,
|
|
|
|
macro_as,
|
|
|
|
expression,
|
|
|
|
which,
|
|
|
|
is,
|
|
|
|
loooooooooooooooong
|
|
|
|
)
|
|
|
|
}
|
|
|
|
Some(p) => baz!(one_item_macro_as_expression_which_is_also_loooooooooooooooong),
|
|
|
|
};
|
|
|
|
}
|