- if ty.is_integral() {
- span_lint(cx, INTEGER_ARITHMETIC, expr.span, "integer arithmetic detected");
- self.expr_span = Some(expr.span);
- } else if ty.is_floating_point() {
- span_lint(cx, FLOAT_ARITHMETIC, expr.span, "floating-point arithmetic detected");
- self.expr_span = Some(expr.span);
+ if constant_simple(cx, cx.tables, expr).is_none() {
+ if ty.is_integral() {
+ span_lint(cx, INTEGER_ARITHMETIC, expr.span, "integer arithmetic detected");
+ self.expr_span = Some(expr.span);
+ } else if ty.is_floating_point() {
+ span_lint(cx, FLOAT_ARITHMETIC, expr.span, "floating-point arithmetic detected");
+ self.expr_span = Some(expr.span);
+ }