@@ -28,40 +28,26 @@ declare_lint_pass!(RedundantSemicolons => [REDUNDANT_SEMICOLONS]);
28
28
29
29
impl EarlyLintPass for RedundantSemicolons {
30
30
fn check_block ( & mut self , cx : & EarlyContext < ' _ > , block : & Block ) {
31
- let mut after_item_stmt = false ;
32
31
let mut seq = None ;
33
32
for stmt in block. stmts . iter ( ) {
34
33
match ( & stmt. kind , & mut seq) {
35
34
( StmtKind :: Empty , None ) => seq = Some ( ( stmt. span , false ) ) ,
36
35
( StmtKind :: Empty , Some ( seq) ) => * seq = ( seq. 0 . to ( stmt. span ) , true ) ,
37
- ( _, seq) => {
38
- maybe_lint_redundant_semis ( cx, seq, after_item_stmt) ;
39
- after_item_stmt = matches ! ( stmt. kind, StmtKind :: Item ( _) ) ;
40
- }
36
+ ( _, seq) => maybe_lint_redundant_semis ( cx, seq) ,
41
37
}
42
38
}
43
- maybe_lint_redundant_semis ( cx, & mut seq, after_item_stmt ) ;
39
+ maybe_lint_redundant_semis ( cx, & mut seq) ;
44
40
}
45
41
}
46
42
47
- fn maybe_lint_redundant_semis (
48
- cx : & EarlyContext < ' _ > ,
49
- seq : & mut Option < ( Span , bool ) > ,
50
- after_item_stmt : bool ,
51
- ) {
43
+ fn maybe_lint_redundant_semis ( cx : & EarlyContext < ' _ > , seq : & mut Option < ( Span , bool ) > ) {
52
44
if let Some ( ( span, multiple) ) = seq. take ( ) {
53
45
// FIXME: Find a better way of ignoring the trailing
54
46
// semicolon from macro expansion
55
47
if span == rustc_span:: DUMMY_SP {
56
48
return ;
57
49
}
58
50
59
- // FIXME: Lint on semicolons after item statements
60
- // once doing so doesn't break bootstrapping
61
- if after_item_stmt {
62
- return ;
63
- }
64
-
65
51
cx. struct_span_lint ( REDUNDANT_SEMICOLONS , span, |lint| {
66
52
let ( msg, rem) = if multiple {
67
53
( "unnecessary trailing semicolons" , "remove these semicolons" )
0 commit comments