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