]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_lint/redundant_semicolon.rs
lints: move a comment
[rust.git] / src / librustc_lint / redundant_semicolon.rs
index 7c9df3578b59cd22a168821e94261d6eb8003bb1..21b244ad75d4e048c52233abf670497c53ac403d 100644 (file)
@@ -1,6 +1,6 @@
-use crate::lint::{EarlyLintPass, LintPass, EarlyContext, LintArray, LintContext};
-use syntax::ast::{Stmt, StmtKind, ExprKind};
-use syntax::errors::Applicability;
+use crate::{EarlyContext, EarlyLintPass, LintContext};
+use rustc_errors::Applicability;
+use syntax::ast::{ExprKind, Stmt, StmtKind};
 
 declare_lint! {
     pub REDUNDANT_SEMICOLON,
@@ -12,8 +12,8 @@
 
 impl EarlyLintPass for RedundantSemicolon {
     fn check_stmt(&mut self, cx: &EarlyContext<'_>, stmt: &Stmt) {
-        if let StmtKind::Semi(expr) = &stmt.node {
-            if let ExprKind::Tup(ref v) = &expr.node {
+        if let StmtKind::Semi(expr) = &stmt.kind {
+            if let ExprKind::Tup(ref v) = &expr.kind {
                 if v.is_empty() {
                     // Strings of excess semicolons are encoded as empty tuple expressions
                     // during the parsing stage, so we check for empty tuple expressions
@@ -26,11 +26,7 @@ fn check_stmt(&mut self, cx: &EarlyContext<'_>, stmt: &Stmt) {
                             } else {
                                 "unnecessary trailing semicolon"
                             };
-                            let mut err = cx.struct_span_lint(
-                                REDUNDANT_SEMICOLON,
-                                stmt.span,
-                                &msg
-                            );
+                            let mut err = cx.struct_span_lint(REDUNDANT_SEMICOLON, stmt.span, &msg);
                             let suggest_msg = if multiple {
                                 "remove these semicolons"
                             } else {
@@ -40,7 +36,7 @@ fn check_stmt(&mut self, cx: &EarlyContext<'_>, stmt: &Stmt) {
                                 stmt.span,
                                 &suggest_msg,
                                 String::new(),
-                                Applicability::MaybeIncorrect
+                                Applicability::MaybeIncorrect,
                             );
                             err.emit();
                         }