Skip to content

Commit d8986a4

Browse files
committed
add failing tests
1 parent 32a216e commit d8986a4

File tree

3 files changed

+81
-7
lines changed

3 files changed

+81
-7
lines changed

tests/ui/semicolon_inside_block.fixed

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
clippy::unused_unit,
44
clippy::unnecessary_operation,
55
clippy::no_effect,
6-
clippy::single_element_loop
6+
clippy::single_element_loop,
7+
clippy::double_parens
78
)]
89
#![warn(clippy::semicolon_inside_block)]
910

@@ -86,3 +87,19 @@ fn main() {
8687

8788
unit_fn_block()
8889
}
90+
91+
fn issue15380() {
92+
#[rustfmt::skip]
93+
( {0;0;}
94+
//~^ semicolon_inside_block
95+
96+
({
97+
//~^ semicolon_inside_block
98+
0;
99+
0;
100+
}
101+
102+
#[rustfmt::skip]
103+
(({0;}
104+
//~^ semicolon_inside_block
105+
}

tests/ui/semicolon_inside_block.rs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
clippy::unused_unit,
44
clippy::unnecessary_operation,
55
clippy::no_effect,
6-
clippy::single_element_loop
6+
clippy::single_element_loop,
7+
clippy::double_parens
78
)]
89
#![warn(clippy::semicolon_inside_block)]
910

@@ -86,3 +87,19 @@ fn main() {
8687

8788
unit_fn_block()
8889
}
90+
91+
fn issue15380() {
92+
#[rustfmt::skip]
93+
( {0;0});
94+
//~^ semicolon_inside_block
95+
96+
({
97+
//~^ semicolon_inside_block
98+
0;
99+
0
100+
});
101+
102+
#[rustfmt::skip]
103+
(({0})) ;
104+
//~^ semicolon_inside_block
105+
}

tests/ui/semicolon_inside_block.stderr

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: consider moving the `;` inside the block for consistent formatting
2-
--> tests/ui/semicolon_inside_block.rs:38:5
2+
--> tests/ui/semicolon_inside_block.rs:39:5
33
|
44
LL | { unit_fn_block() };
55
| ^^^^^^^^^^^^^^^^^^^^
@@ -13,7 +13,7 @@ LL + { unit_fn_block(); }
1313
|
1414

1515
error: consider moving the `;` inside the block for consistent formatting
16-
--> tests/ui/semicolon_inside_block.rs:40:5
16+
--> tests/ui/semicolon_inside_block.rs:41:5
1717
|
1818
LL | unsafe { unit_fn_block() };
1919
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -25,7 +25,7 @@ LL + unsafe { unit_fn_block(); }
2525
|
2626

2727
error: consider moving the `;` inside the block for consistent formatting
28-
--> tests/ui/semicolon_inside_block.rs:49:5
28+
--> tests/ui/semicolon_inside_block.rs:50:5
2929
|
3030
LL | / {
3131
LL | |
@@ -41,7 +41,7 @@ LL ~ }
4141
|
4242

4343
error: consider moving the `;` inside the block for consistent formatting
44-
--> tests/ui/semicolon_inside_block.rs:63:5
44+
--> tests/ui/semicolon_inside_block.rs:64:5
4545
|
4646
LL | { m!(()) };
4747
| ^^^^^^^^^^^
@@ -52,5 +52,45 @@ LL - { m!(()) };
5252
LL + { m!(()); }
5353
|
5454

55-
error: aborting due to 4 previous errors
55+
error: consider moving the `;` inside the block for consistent formatting
56+
--> tests/ui/semicolon_inside_block.rs:93:5
57+
|
58+
LL | ( {0;0});
59+
| ^^^^^^^^^
60+
|
61+
help: put the `;` here
62+
|
63+
LL - ( {0;0});
64+
LL + ( {0;0;}
65+
|
66+
67+
error: consider moving the `;` inside the block for consistent formatting
68+
--> tests/ui/semicolon_inside_block.rs:96:5
69+
|
70+
LL | / ({
71+
LL | |
72+
LL | | 0;
73+
LL | | 0
74+
LL | | });
75+
| |_______^
76+
|
77+
help: put the `;` here
78+
|
79+
LL ~ 0;
80+
LL ~ }
81+
|
82+
83+
error: consider moving the `;` inside the block for consistent formatting
84+
--> tests/ui/semicolon_inside_block.rs:103:5
85+
|
86+
LL | (({0})) ;
87+
| ^^^^^^^^^^^^
88+
|
89+
help: put the `;` here
90+
|
91+
LL - (({0})) ;
92+
LL + (({0;}
93+
|
94+
95+
error: aborting due to 7 previous errors
5696

0 commit comments

Comments
 (0)