|
| 1 | +// _0: in-macro |
| 2 | +// _1: last argument in function invocation |
| 3 | +// _2: non-last argument in function invocation |
| 4 | +// _3: simple expression |
| 5 | + |
| 6 | +// test0: the cause reported in issue: label is used, and there is usage, multiple statements |
| 7 | +pub fn rustfmt_test0_0(condition: bool) { |
| 8 | + test_macro!(|transaction| 'block: { |
| 9 | + if condition { |
| 10 | + break 'block 0; |
| 11 | + } |
| 12 | + |
| 13 | + todo!() |
| 14 | + }); |
| 15 | +} |
| 16 | + |
| 17 | +pub fn rustfmt_test0_1(condition: bool) { |
| 18 | + test_func(|transaction| 'block: { |
| 19 | + if condition { |
| 20 | + break 'block 0; |
| 21 | + } |
| 22 | + |
| 23 | + todo!() |
| 24 | + }); |
| 25 | +} |
| 26 | + |
| 27 | +pub fn rustfmt_test0_2(condition: bool) { |
| 28 | + test_func2(|transaction| 'block: { |
| 29 | + if condition { |
| 30 | + break 'block 0; |
| 31 | + } |
| 32 | + |
| 33 | + todo!() |
| 34 | + }, 0); |
| 35 | +} |
| 36 | + |
| 37 | +pub fn rustfmt_test0_3(condition: bool) { |
| 38 | + let x = |transaction| 'block: { |
| 39 | + if condition { |
| 40 | + break 'block 0; |
| 41 | + } |
| 42 | + |
| 43 | + todo!() |
| 44 | + }; |
| 45 | +} |
| 46 | + |
| 47 | + |
| 48 | +// test1: label is unused, and there is usage, multiple statements |
| 49 | +pub fn rustfmt_test1_0(condition: bool) { |
| 50 | + test_macro!(|transaction| 'block: { |
| 51 | + if condition { |
| 52 | + todo!(""); |
| 53 | + } |
| 54 | + |
| 55 | + todo!() |
| 56 | + }); |
| 57 | +} |
| 58 | + |
| 59 | +pub fn rustfmt_test1_1(condition: bool) { |
| 60 | + test_func(|transaction| 'block: { |
| 61 | + if condition { |
| 62 | + todo!(""); |
| 63 | + } |
| 64 | + |
| 65 | + todo!() |
| 66 | + }); |
| 67 | +} |
| 68 | + |
| 69 | +pub fn rustfmt_test1_2(condition: bool) { |
| 70 | + test_func2(|transaction| 'block: { |
| 71 | + if condition { |
| 72 | + todo!(""); |
| 73 | + } |
| 74 | + |
| 75 | + todo!() |
| 76 | + }, 0); |
| 77 | +} |
| 78 | + |
| 79 | +pub fn rustfmt_test1_3(condition: bool) { |
| 80 | + let x = |transaction| 'block: { |
| 81 | + if condition { |
| 82 | + todo!(""); |
| 83 | + } |
| 84 | + |
| 85 | + todo!() |
| 86 | + }; |
| 87 | +} |
| 88 | + |
| 89 | + |
| 90 | + |
| 91 | +// test2: label is used, single expression |
| 92 | +pub fn rustfmt_test2_0(condition: bool) { |
| 93 | + test_macro!(|transaction| 'block: { |
| 94 | + break 'block 0; |
| 95 | + }); |
| 96 | +} |
| 97 | + |
| 98 | +pub fn rustfmt_test2_1(condition: bool) { |
| 99 | + test_func(|transaction| 'block: { |
| 100 | + break 'block 0; |
| 101 | + }); |
| 102 | +} |
| 103 | + |
| 104 | +pub fn rustfmt_test2_2(condition: bool) { |
| 105 | + test_func2(|transaction| 'block: { |
| 106 | + break 'block 0; |
| 107 | + }, 0); |
| 108 | +} |
| 109 | + |
| 110 | +pub fn rustfmt_test2_3(condition: bool) { |
| 111 | + let x = |transaction| 'block: { |
| 112 | + break 'block 0; |
| 113 | + }; |
| 114 | +} |
| 115 | + |
| 116 | +// test3: label is unused, single general multi-line expression |
| 117 | +pub fn rustfmt_test3_0(condition: bool) { |
| 118 | + test_macro!(|transaction| 'block: { |
| 119 | + vec![ |
| 120 | + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 121 | + 0, |
| 122 | + ] |
| 123 | + }); |
| 124 | +} |
| 125 | + |
| 126 | +pub fn rustfmt_test3_1(condition: bool) { |
| 127 | + test_func(|transaction| 'block: { |
| 128 | + vec![ |
| 129 | + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 130 | + 0, |
| 131 | + ] |
| 132 | + }); |
| 133 | +} |
| 134 | + |
| 135 | +pub fn rustfmt_test3_2(condition: bool) { |
| 136 | + test_func2(|transaction| 'block: { |
| 137 | + vec![ |
| 138 | + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 139 | + 0, |
| 140 | + ] |
| 141 | + }, 0); |
| 142 | +} |
| 143 | + |
| 144 | +pub fn rustfmt_test3_3(condition: bool) { |
| 145 | + let x = |transaction| 'block: { |
| 146 | + vec![ |
| 147 | + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 148 | + 0, |
| 149 | + ] |
| 150 | + }; |
| 151 | +} |
| 152 | + |
| 153 | +// test4: label is unused, single block statement-expression |
| 154 | +pub fn rustfmt_test4_0(condition: bool) { |
| 155 | + test_macro!(|transaction| 'block: { |
| 156 | + if condition { |
| 157 | + break 'block 1; |
| 158 | + } else { |
| 159 | + break 'block 0; |
| 160 | + } |
| 161 | + }); |
| 162 | +} |
| 163 | + |
| 164 | +pub fn rustfmt_test4_1(condition: bool) { |
| 165 | + test_func(|transaction| 'block: { |
| 166 | + if condition { |
| 167 | + break 'block 1; |
| 168 | + } else { |
| 169 | + break 'block 0; |
| 170 | + } |
| 171 | + }); |
| 172 | +} |
| 173 | + |
| 174 | +pub fn rustfmt_test4_2(condition: bool) { |
| 175 | + test_func2(|transaction| 'block: { |
| 176 | + if condition { |
| 177 | + break 'block 1; |
| 178 | + } else { |
| 179 | + break 'block 0; |
| 180 | + } |
| 181 | + }, 1); |
| 182 | +} |
| 183 | + |
| 184 | +pub fn rustfmt_test4_3(condition: bool) { |
| 185 | + let x = |transaction| 'block: { |
| 186 | + if condition { |
| 187 | + break 'block 1; |
| 188 | + } else { |
| 189 | + break 'block 0; |
| 190 | + } |
| 191 | + }; |
| 192 | +} |
0 commit comments