1 use clippy_utils::consts::{constant, Constant};
2 use clippy_utils::diagnostics::span_lint;
3 use clippy_utils::is_trait_method;
5 use rustc_lint::LateContext;
8 use super::ITERATOR_STEP_BY_ZERO;
10 pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, expr: &hir::Expr<'_>, arg: &'tcx hir::Expr<'_>) {
11 if is_trait_method(cx, expr, sym::Iterator) {
12 if let Some((Constant::Int(0), _)) = constant(cx, cx.typeck_results(), arg) {
15 ITERATOR_STEP_BY_ZERO,
17 "`Iterator::step_by(0)` will panic at runtime",