From b417f01ed82332cd81954ac6d9f5bad615db2bfc Mon Sep 17 00:00:00 2001 From: "R.Chavignat" Date: Thu, 20 Aug 2015 14:36:26 +0200 Subject: [PATCH] Also test that the CastExpr's right arm is numeric. --- src/types.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/types.rs b/src/types.rs index d6081153f010..3f7012f6ca8c 100644 --- a/src/types.rs +++ b/src/types.rs @@ -156,7 +156,7 @@ impl LintPass for CastPass { fn check_expr(&mut self, cx: &Context, expr: &Expr) { if let ExprCast(ref ex, _) = expr.node { let (cast_from, cast_to) = (cx.tcx.expr_ty(&*ex), cx.tcx.expr_ty(expr)); - if cast_from.is_numeric() && !in_external_macro(cx, expr.span) { + if cast_from.is_numeric() && cast_to.is_numeric() && !in_external_macro(cx, expr.span) { match (cast_from.is_integral(), cast_to.is_integral()) { (true, false) => { match (&cast_from.sty, &cast_to.sty) {