removed lint for division/modulo for literal 0
This commit is contained in:
parent
e97602e482
commit
fa0a78b130
2 changed files with 2 additions and 19 deletions
|
|
@ -90,12 +90,7 @@ impl<'tcx> LateLintPass<'tcx> for Arithmetic {
|
|||
if l_ty.peel_refs().is_integral() && r_ty.peel_refs().is_integral() {
|
||||
match op.node {
|
||||
hir::BinOpKind::Div | hir::BinOpKind::Rem => match &r.kind {
|
||||
hir::ExprKind::Lit(lit) => {
|
||||
if let rustc_ast::ast::LitKind::Int(0, _) = lit.node {
|
||||
span_lint(cx, INTEGER_ARITHMETIC, expr.span, "integer arithmetic detected");
|
||||
self.expr_span = Some(expr.span);
|
||||
}
|
||||
},
|
||||
hir::ExprKind::Lit(_lit) => (),
|
||||
hir::ExprKind::Unary(hir::UnOp::UnNeg, expr) => {
|
||||
if let hir::ExprKind::Lit(lit) = &expr.kind {
|
||||
if let rustc_ast::ast::LitKind::Int(1, _) = lit.node {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue