]> git.lizzy.rs Git - rust.git/blob - src/tools/rustfmt/tests/source/fn_args_layout-vertical.rs
Rollup merge of #106769 - lenko-d:libtest-print_why_a_test_was_ignored_if_its_the_onl...
[rust.git] / src / tools / rustfmt / tests / source / fn_args_layout-vertical.rs
1 // rustfmt-fn_params_layout: Vertical
2
3 // Empty list should stay on one line.
4 fn do_bar(
5
6 ) -> u8 {
7     bar()
8 }
9
10 // A single argument should stay on the same line.
11 fn do_bar(
12         a: u8) -> u8 {
13     bar()
14 }
15
16 // Multiple arguments should each get their own line.
17 fn 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.
27 fn 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 }