//! ```
//!
//! This lint is **warn** by default.
+use rustc_ast::ast;
use rustc_lint::{EarlyContext, EarlyLintPass};
use rustc_session::{declare_lint_pass, declare_tool_lint};
use rustc_span::source_map::{original_sp, DUMMY_SP};
use rustc_span::Span;
-use syntax::ast;
use crate::utils::{indent_of, snippet, snippet_block, span_lint_and_help};
{
if let ast::ExprKind::While(_, loop_block, label)
| ast::ExprKind::ForLoop(_, _, loop_block, label)
- | ast::ExprKind::Loop(loop_block, label) = &expr.kind
+ | ast::ExprKind::Loop(loop_block, label, ..) = &expr.kind
{
func(loop_block, label.as_ref());
}
NEEDLESS_CONTINUE,
expr.span,
message,
+ None,
&format!("{}\n{}", header, snip),
);
}
break;
}
}
- if ret.is_empty() {
- s.to_string()
- } else {
- ret
- }
+ if ret.is_empty() { s.to_string() } else { ret }
}
fn span_of_first_expr_in_block(block: &ast::Block) -> Option<Span> {
- block.stmts.iter().next().map(|stmt| stmt.span)
+ block.stmts.get(0).map(|stmt| stmt.span)
}
#[cfg(test)]