Skip to content

Commit 620e596

Browse files
committed
fix the test case from lintcheck???
1 parent 7d63e95 commit 620e596

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

tests/ui/semicolon_outside_block.fixed

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,3 +121,16 @@ fn issue14926() {
121121
},
122122
}
123123
}
124+
125+
fn f() {
126+
struct Vec;
127+
impl Vec {
128+
unsafe fn set_len(&mut self, _len: usize) {}
129+
fn clear(&mut self) {
130+
unsafe {
131+
//~^ semicolon_outside_block
132+
self.set_len(0)
133+
};
134+
}
135+
}
136+
}

tests/ui/semicolon_outside_block.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ fn f() {
128128
unsafe fn set_len(&mut self, _len: usize) {}
129129
fn clear(&mut self) {
130130
unsafe {
131+
//~^ semicolon_outside_block
131132
self.set_len(0);
132133
}
133134
}

tests/ui/semicolon_outside_block.stderr

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,5 +82,20 @@ LL ~ line!()
8282
LL ~ };
8383
|
8484

85-
error: aborting due to 6 previous errors
85+
error: consider moving the `;` outside the block for consistent formatting
86+
--> tests/ui/semicolon_outside_block.rs:130:13
87+
|
88+
LL | / unsafe {
89+
LL | |
90+
LL | | self.set_len(0);
91+
LL | | }
92+
| |_____________^
93+
|
94+
help: put the `;` here
95+
|
96+
LL ~ self.set_len(0)
97+
LL ~ };
98+
|
99+
100+
error: aborting due to 7 previous errors
86101

0 commit comments

Comments
 (0)