diff --git a/src/consts.rs b/src/consts.rs index 7cb0683711a..37322aeffc8 100644 --- a/src/consts.rs +++ b/src/consts.rs @@ -15,16 +15,16 @@ use syntax::ptr::P; #[derive(Debug, Copy, Clone)] pub enum FloatWidth { - Fw32, - Fw64, - FwAny, + F32, + F64, + Any, } impl From for FloatWidth { fn from(ty: FloatTy) -> FloatWidth { match ty { - FloatTy::F32 => FloatWidth::Fw32, - FloatTy::F64 => FloatWidth::Fw64, + FloatTy::F32 => FloatWidth::F32, + FloatTy::F64 => FloatWidth::F64, } } } @@ -200,7 +200,7 @@ fn lit_to_constant(lit: &LitKind) -> Constant { LitKind::Char(c) => Constant::Char(c), LitKind::Int(value, ty) => Constant::Int(value, ty, Sign::Plus), LitKind::Float(ref is, ty) => Constant::Float(is.to_string(), ty.into()), - LitKind::FloatUnsuffixed(ref is) => Constant::Float(is.to_string(), FloatWidth::FwAny), + LitKind::FloatUnsuffixed(ref is) => Constant::Float(is.to_string(), FloatWidth::Any), LitKind::Bool(b) => Constant::Bool(b), } } diff --git a/src/zero_div_zero.rs b/src/zero_div_zero.rs index 1576d699a4a..dbfa2744189 100644 --- a/src/zero_div_zero.rs +++ b/src/zero_div_zero.rs @@ -47,8 +47,8 @@ impl LateLintPass for ZeroDivZeroPass { // since we're about to suggest a use of std::f32::NaN or std::f64::NaN, // match the precision of the literals that are given. let float_type = match (lhs_width, rhs_width) { - (FloatWidth::Fw64, _) - | (_, FloatWidth::Fw64) => "f64", + (FloatWidth::F64, _) + | (_, FloatWidth::F64) => "f64", _ => "f32" }; span_help_and_lint(cx, ZERO_DIVIDED_BY_ZERO, expr.span, diff --git a/tests/consts.rs b/tests/consts.rs index 67be4243335..5c6088d0554 100644 --- a/tests/consts.rs +++ b/tests/consts.rs @@ -77,9 +77,9 @@ fn test_ops() { check(ONE, &binop(BiMul, litone.clone(), litone.clone())); check(ONE, &binop(BiDiv, litone.clone(), litone.clone())); - let half_any = Constant::Float("0.5".into(), FloatWidth::FwAny); - let half32 = Constant::Float("0.5".into(), FloatWidth::Fw32); - let half64 = Constant::Float("0.5".into(), FloatWidth::Fw64); + let half_any = Constant::Float("0.5".into(), FloatWidth::Any); + let half32 = Constant::Float("0.5".into(), FloatWidth::F32); + let half64 = Constant::Float("0.5".into(), FloatWidth::F64); assert_eq!(half_any, half32); assert_eq!(half_any, half64);