• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // rustfmt-fn_params_layout: Vertical
2 
3 // Empty list should stay on one line.
do_bar( ) -> u84 fn do_bar(
5 
6 ) -> u8 {
7     bar()
8 }
9 
10 // A single argument should stay on the same line.
do_bar( a: u8) -> u811 fn do_bar(
12         a: u8) -> u8 {
13     bar()
14 }
15 
16 // Multiple arguments should each get their own line.
do_bar(a: u8, mut b: u8, c: &u8, d: &mut u8, closure: &Fn(i32) -> i32) -> i3217 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.
do_this_that_and_the_other_thing( aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: u8, b: u8, c: u8, d: u8)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 }
34