blob: e100a4aadf71327bdc7b0d801b8f9f8e2ae86e33 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
fn main() {
// This line is too long
sprogress := if b.no_cstep {
'TMP1/${b.nexpected_steps:1d}'
} else {
'${b.cstep:1d}/${b.nexpected_steps:1d}'
}
// Normal struct inits
_ := if true {
Foo{}
} else {
Foo{
x: 5
}
}
_ := if some_cond {
Bar{
a: 'bar'
b: 'also bar'
}
} else {
Bar{}
}
}
fn condition_is_very_long_infix() {
val := if the_first_condition && this_is_required_too
&& (another_cond || foobar_to_exceed_the_max_len) {
'true'
} else {
'false'
}
}
fn branches_are_long_fn_calls() {
_ := 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))
}
// With another arg to make fn call exceed the max_len after if unwrapping
_ := 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'))
}
}
|