Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
c410-f3r committed Apr 15, 2023
1 parent cd0009e commit d639062
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions clippy_lints/src/operators/numeric_arithmetic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ impl Context {
self.expr_id.is_some() || self.const_span.map_or(false, |span| span.contains(e.span))
}

fn skip_expr_involving_integers<'tcx>(cx: &LateContext<'tcx>, e: &hir::Expr<'tcx>) -> bool {
is_from_proc_macro(cx, e)
}

pub fn check_binary<'tcx>(
&mut self,
cx: &LateContext<'tcx>,
Expand Down Expand Up @@ -51,7 +47,7 @@ impl Context {

let (l_ty, r_ty) = (cx.typeck_results().expr_ty(l), cx.typeck_results().expr_ty(r));
if l_ty.peel_refs().is_integral() && r_ty.peel_refs().is_integral() {
if Self::skip_expr_involving_integers(cx, expr) {
if is_from_proc_macro(cx, expr) {
return;
}
match op {
Expand Down Expand Up @@ -86,7 +82,7 @@ impl Context {
let ty = cx.typeck_results().expr_ty(arg);
if constant_simple(cx, cx.typeck_results(), expr).is_none() {
if ty.is_integral() {
if Self::skip_expr_involving_integers(cx, expr) {
if is_from_proc_macro(cx, expr) {
return;
}
span_lint(cx, INTEGER_ARITHMETIC, expr.span, "integer arithmetic detected");
Expand Down

0 comments on commit d639062

Please sign in to comment.