-use crate::lint::{EarlyLintPass, LintPass, EarlyContext, LintArray, LintContext};
-use syntax::ast::{Stmt, StmtKind, ExprKind};
+use crate::lint::{EarlyContext, EarlyLintPass, LintArray, LintContext, LintPass};
+use syntax::ast::{ExprKind, Stmt, StmtKind};
use syntax::errors::Applicability;
declare_lint! {
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
} 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 {
stmt.span,
&suggest_msg,
String::new(),
- Applicability::MaybeIncorrect
+ Applicability::MaybeIncorrect,
);
err.emit();
}