@@ -28,40 +28,26 @@ declare_lint_pass!(RedundantSemicolons => [REDUNDANT_SEMICOLONS]);
2828
2929impl EarlyLintPass for RedundantSemicolons {
3030 fn check_block ( & mut self , cx : & EarlyContext < ' _ > , block : & Block ) {
31- let mut after_item_stmt = false ;
3231 let mut seq = None ;
3332 for stmt in block. stmts . iter ( ) {
3433 match ( & stmt. kind , & mut seq) {
3534 ( StmtKind :: Empty , None ) => seq = Some ( ( stmt. span , false ) ) ,
3635 ( 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) ,
4137 }
4238 }
43- maybe_lint_redundant_semis ( cx, & mut seq, after_item_stmt ) ;
39+ maybe_lint_redundant_semis ( cx, & mut seq) ;
4440 }
4541}
4642
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 ) > ) {
5244 if let Some ( ( span, multiple) ) = seq. take ( ) {
5345 // FIXME: Find a better way of ignoring the trailing
5446 // semicolon from macro expansion
5547 if span == rustc_span:: DUMMY_SP {
5648 return ;
5749 }
5850
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-
6551 cx. struct_span_lint ( REDUNDANT_SEMICOLONS , span, |lint| {
6652 let ( msg, rem) = if multiple {
6753 ( "unnecessary trailing semicolons" , "remove these semicolons" )
0 commit comments