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