Almost there

This commit is contained in:
Oliver Schneider
2017-03-01 18:46:18 +01:00
parent 6f0fd15da9
commit 7bfa53f504
6 changed files with 70 additions and 159 deletions

View File

@@ -36,8 +36,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
// TODO - constant_simple does not fold many operations involving floats.
// That's probably fine for this lint - it's pretty unlikely that someone would
// do something like 0.0/(2.0 - 2.0), but it would be nice to warn on that case too.
let Some(Constant::Float(ref lhs_value, lhs_width)) = constant_simple(left),
let Some(Constant::Float(ref rhs_value, rhs_width)) = constant_simple(right),
let Some(Constant::Float(ref lhs_value, lhs_width)) = constant_simple(cx, left),
let Some(Constant::Float(ref rhs_value, rhs_width)) = constant_simple(cx, right),
let Ok(0.0) = lhs_value.parse(),
let Ok(0.0) = rhs_value.parse()
], {