Skip to content

Commit 55c70e9

Browse files
committed
Fix previous snippets from breaking LL2
1 parent ac24987 commit 55c70e9

File tree

3 files changed

+24
-33
lines changed

3 files changed

+24
-33
lines changed

src/lint/rules/tests/indentation/continuation_line.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ fn continuation_line_correct() {
1515

1616
static CONTINUATION_LINE_RETURN_CORRECT: &str = "
1717
method calculate_sum(uint64 a, uint64 b) -> (uint64) {
18-
return (a + b) * (a - b) +
19-
(a * b);
18+
return (a + b) * (a - b)
19+
+ (a * b);
2020
}
2121
";
2222
#[test]
@@ -29,8 +29,8 @@ static CONTINUATION_LINE_LOCAL_DECLA_CORRECT: &str = "
2929
bank regs {
3030
register example_register size 4 @ 0x00 {
3131
method read() -> (uint64) {
32-
local uint64 value = (this.val + 10) *
33-
(this.val - 5);
32+
local uint64 value = (this.val + 10)
33+
* (this.val - 5);
3434
return value;
3535
}
3636
}
@@ -87,8 +87,8 @@ fn continuation_line_incorrect() {
8787
pub static CONTINUATION_LINE_BITWISE_INCORRECT: &str = "
8888
method write(uint64 value) {
8989
local uint64 a = value;
90-
local uint64 result = a <<
91-
2;
90+
local uint64 result = a
91+
<< 2;
9292
log info: 'Writing to register, result after left shift = %x', result;
9393
}
9494
";
@@ -97,7 +97,7 @@ fn continuation_line_bitwise_incorrect() {
9797
let rules = set_up();
9898
let expected_errors = define_expected_errors!(
9999
RuleType::IN6,
100-
(4, 4, 31, 32),
100+
(4, 4, 31, 33),
101101
);
102102
assert_snippet(CONTINUATION_LINE_BITWISE_INCORRECT, expected_errors, &rules);
103103
}
@@ -106,8 +106,8 @@ pub static CONTINUATION_LINE_PARAM_INCORRECT: &str = "
106106
bank regs {
107107
register control size 4 @ 0x00 {
108108
field status @ [31:3] {
109-
param init_val = 1 << 2 |
110-
1 << 1;
109+
param init_val = 1 << 2
110+
| 1 << 1;
111111
}
112112
}
113113
}

src/lint/rules/tests/indentation/paren_expr.rs

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ fn funcall_nested_paren_incorrect() {
130130

131131
static IF_PAREN_CORRECT: &str = "
132132
method callback() {
133-
if (conditionX &&
134-
conditionY) {
133+
if (conditionX
134+
&& conditionY) {
135135
return;
136136
}
137137
}
@@ -144,8 +144,8 @@ fn if_paren_correct() {
144144

145145
static IF_PAREN_INCORRECT: &str = "
146146
method callback() {
147-
if (conditionX &&
148-
conditionY) {
147+
if (conditionX
148+
&& conditionY) {
149149
return;
150150
}
151151
}
@@ -155,7 +155,7 @@ fn if_paren_incorrect() {
155155
let rules = set_up();
156156
let expected_errors = define_expected_errors!(
157157
RuleType::IN5,
158-
(3, 3, 10, 20),
158+
(3, 3, 10, 12),
159159
);
160160
assert_snippet(IF_PAREN_INCORRECT, expected_errors, &rules);
161161
}
@@ -348,10 +348,8 @@ fn switch_paren_incorrect() {
348348
static NESTED_PAREN_EXPR_CORRECT: &str = "
349349
param result = ((reg0.val
350350
* reg1.enable.val)
351-
&
352-
mask_reg
353-
+
354-
1);
351+
& mask_reg
352+
+ 1);
355353
";
356354

357355
#[test]
@@ -363,18 +361,16 @@ fn nested_paren_expr_correct(){
363361
static NESTED_PAREN_EXPR_INCORRECT: &str = "
364362
param result = ((reg0.val
365363
* reg1.enable.val)
366-
&
367-
mask_reg
368-
+
369-
1);
364+
& mask_reg
365+
+ 1);
370366
";
371367
#[test]
372368
fn nested_paren_expr_incorrect(){
373369
let rules = set_up();
374370
let expected_errors = define_expected_errors!(
375371
RuleType::IN5,
376372
(2, 2, 5, 6),
377-
(4, 4, 17, 25),
373+
(3, 3, 17, 18),
378374
);
379375
assert_snippet(NESTED_PAREN_EXPR_INCORRECT, expected_errors, &rules);
380376
}

src/lint/rules/tests/line_length_breaking/func_call_break_open_paren.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,8 @@ static PAREN_NESTED_CORRECT: &str = "
5959
param result = (
6060
(reg0.val
6161
* reg1.enable.val)
62-
&
63-
mask_reg
64-
+
65-
1);
62+
& mask_reg
63+
+ 1);
6664
";
6765

6866
#[test]
@@ -75,10 +73,8 @@ static PAREN_NESTED_INCORRECT: &str = "
7573
param result = (
7674
(reg0.val
7775
* reg1.enable.val)
78-
&
79-
mask_reg
80-
+
81-
1);
76+
& mask_reg
77+
+ 1);
8278
";
8379

8480
#[test]
@@ -87,8 +83,7 @@ fn paren_nested_incorrect(){
8783
let expected_errors = define_expected_errors!(
8884
RuleType::LL6,
8985
(4, 4, 16, 17),
90-
(6, 6, 16, 17),
91-
(7, 7, 16, 17),
86+
(5, 5, 16, 17),
9287
);
9388
assert_snippet(PAREN_NESTED_INCORRECT, expected_errors, &rules);
9489
}

0 commit comments

Comments
 (0)