Cleanup misc::check_nan

This was a bit messed up after a bigger rebase.
This commit is contained in:
Philipp Hansch 2018-04-08 10:41:51 +02:00
parent 991a30237a
commit ca60e8a2a0
No known key found for this signature in database
GPG Key ID: B6FA06A6E0E2665B
1 changed files with 7 additions and 9 deletions

View File

@ -433,16 +433,14 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
fn check_nan(cx: &LateContext, path: &Path, expr: &Expr) { fn check_nan(cx: &LateContext, path: &Path, expr: &Expr) {
if !in_constant(cx, expr.id) { if !in_constant(cx, expr.id) {
if let Some(seg) = path.segments.last() { if let Some(seg) = path.segments.last() {
path.segments.last().map(|seg| { if seg.name == "NAN" {
if seg.name == "NAN" { span_lint(
span_lint( cx,
cx, CMP_NAN,
CMP_NAN, expr.span,
expr.span, "doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead",
"doomed comparison with NAN, use `std::{f32,f64}::is_nan()` instead",
); );
} }
});
} }
} }
} }