]> git.proxmox.com Git - rustc.git/blame - src/tools/rustfmt/tests/source/fn_args_layout-vertical.rs
New upstream version 1.52.1+dfsg1
[rustc.git] / src / tools / rustfmt / tests / source / fn_args_layout-vertical.rs
CommitLineData
f20569fa
XL
1// rustfmt-fn_args_layout: Vertical
2
3// Empty list should stay on one line.
4fn do_bar(
5
6) -> u8 {
7 bar()
8}
9
10// A single argument should stay on the same line.
11fn do_bar(
12 a: u8) -> u8 {
13 bar()
14}
15
16// Multiple arguments should each get their own line.
17fn do_bar(a: u8, mut b: u8, c: &u8, d: &mut u8, closure: &Fn(i32) -> i32) -> i32 {
18 // This feature should not affect closures.
19 let bar = |x: i32, y: i32| -> i32 { x + y };
20 bar(a, b)
21}
22
23// If the first argument doesn't fit on the same line with the function name,
24// the whole list should probably be pushed to the next line with hanging
25// indent. That's not what happens though, so check current behaviour instead.
26// In any case, it should maintain single argument per line.
27fn do_this_that_and_the_other_thing(
28 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: u8,
29 b: u8, c: u8, d: u8) {
30 this();
31 that();
32 the_other_thing();
33}