| 1 | const ( |
| 2 | spacing_error = if true {true}else{ false} |
| 3 | // Multiline result should not align with the next multiline result. |
| 4 | too_long_line = if b.no_cstep { 'TMP1/${b.nexpected_steps:1d}' } else { '${b.cstep:1d}/${b.nexpected_steps:1d}' } |
| 5 | too_many_branches = if true { true } else if true { true } else { false } |
| 6 | ) |
| 7 | |
| 8 | const ( |
| 9 | align = if true { 'a' } else { 'b' } |
| 10 | some_longer_variable = 'foo' |
| 11 | another_var = 'bar' |
| 12 | ) |
| 13 | |
| 14 | fn main() { |
| 15 | // This line is too long |
| 16 | sprogress := if b.no_cstep { 'TMP1/${b.nexpected_steps:1d}' } else { '${b.cstep:1d}/${b.nexpected_steps:1d}' } |
| 17 | // Normal struct inits |
| 18 | _ := if true { Foo{} } else { Foo{ |
| 19 | x: 5 |
| 20 | } } |
| 21 | _ := if some_cond { Bar{ a: 'bar', b: 'also bar'} } else { Bar{} } |
| 22 | } |
| 23 | |
| 24 | fn condition_is_very_long_infix() { |
| 25 | val := if the_first_condition && this_is_required_too && (another_cond || foobar_to_exceed_the_max_len) { 'true' } else { 'false' } |
| 26 | } |
| 27 | |
| 28 | fn branches_are_long_fn_calls() { |
| 29 | _ := if nr_dims == 1 { t.find_or_register_array(elem_type) } else { t.find_or_register_arra(t.find_or_register_array_with_dims(elem_type, nr_dims - 1)) } |
| 30 | // With another arg to make fn call exceed the max_len after if unwrapping |
| 31 | _ := if nr_dims == 1 { t.find_or_register_array(elem_type) } else { t.find_or_register_arra(t.find_or_register_array_with_dims(elem_type, nr_dims - 1, 'some string')) } |
| 32 | } |
| 33 | |