mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 02:57:37 +00:00
Also test that the CastExpr's right arm is numeric.
This commit is contained in:
parent
93d9249f76
commit
b417f01ed8
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user