if_chain! {
if let ast::ExprKind::Loop(loop_block, ..) = &expr.kind;
if !loop_block.stmts.is_empty();
- if let ast::StmtKind::Semi(ref statement) = loop_block.stmts.last().unwrap().kind;
+ if let ast::StmtKind::Expr(ref statement)
+ | ast::StmtKind::Semi(ref statement) = loop_block.stmts.last().unwrap().kind;
if let ast::ExprKind::Continue(_) = statement.kind;
then {
span_lint_and_help(
|
= help: consider dropping the `continue` expression
+error: this `continue` expression is redundant
+ --> $DIR/needless_continue.rs:70:9
+ |
+LL | continue // should lint here
+ | ^^^^^^^^
+ |
+ = help: consider dropping the `continue` expression
+
+error: this `continue` expression is redundant
+ --> $DIR/needless_continue.rs:78:9
+ |
+LL | continue // should lint here
+ | ^^^^^^^^
+ |
+ = help: consider dropping the `continue` expression
+
error: this `else` block is redundant
- --> $DIR/needless_continue.rs:113:24
+ --> $DIR/needless_continue.rs:128:24
|
LL | } else {
| ________________________^
}
error: there is no need for an explicit `else` block for this `if` expression
- --> $DIR/needless_continue.rs:119:17
+ --> $DIR/needless_continue.rs:134:17
|
LL | / if condition() {
LL | | continue; // should lint here
println!("bar-5");
}
-error: aborting due to 6 previous errors
+error: aborting due to 8 previous errors