mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-30 16:39:26 +00:00
82 lines
2.7 KiB
Text
82 lines
2.7 KiB
Text
error: manually checking if a float is infinite
|
|
--> $DIR/manual_float_methods.rs:23:8
|
|
|
|
|
LL | if x == f32::INFINITY || x == f32::NEG_INFINITY {}
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the dedicated method instead: `x.is_infinite()`
|
|
|
|
|
= note: `-D clippy::manual-is-infinite` implied by `-D warnings`
|
|
= help: to override `-D warnings` add `#[allow(clippy::manual_is_infinite)]`
|
|
|
|
error: manually checking if a float is finite
|
|
--> $DIR/manual_float_methods.rs:24:8
|
|
|
|
|
LL | if x != f32::INFINITY && x != f32::NEG_INFINITY {}
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= note: `-D clippy::manual-is-finite` implied by `-D warnings`
|
|
= help: to override `-D warnings` add `#[allow(clippy::manual_is_finite)]`
|
|
help: use the dedicated method instead
|
|
|
|
|
LL | if x.is_finite() {}
|
|
| ~~~~~~~~~~~~~
|
|
help: this will alter how it handles NaN; if that is a problem, use instead
|
|
|
|
|
LL | if x.is_finite() || x.is_nan() {}
|
|
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
help: or, for conciseness
|
|
|
|
|
LL | if !x.is_infinite() {}
|
|
| ~~~~~~~~~~~~~~~~
|
|
|
|
error: manually checking if a float is infinite
|
|
--> $DIR/manual_float_methods.rs:25:8
|
|
|
|
|
LL | if x == INFINITE || x == NEG_INFINITE {}
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the dedicated method instead: `x.is_infinite()`
|
|
|
|
error: manually checking if a float is finite
|
|
--> $DIR/manual_float_methods.rs:26:8
|
|
|
|
|
LL | if x != INFINITE && x != NEG_INFINITE {}
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
help: use the dedicated method instead
|
|
|
|
|
LL | if x.is_finite() {}
|
|
| ~~~~~~~~~~~~~
|
|
help: this will alter how it handles NaN; if that is a problem, use instead
|
|
|
|
|
LL | if x.is_finite() || x.is_nan() {}
|
|
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
help: or, for conciseness
|
|
|
|
|
LL | if !x.is_infinite() {}
|
|
| ~~~~~~~~~~~~~~~~
|
|
|
|
error: manually checking if a float is infinite
|
|
--> $DIR/manual_float_methods.rs:28:8
|
|
|
|
|
LL | if x == f64::INFINITY || x == f64::NEG_INFINITY {}
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the dedicated method instead: `x.is_infinite()`
|
|
|
|
error: manually checking if a float is finite
|
|
--> $DIR/manual_float_methods.rs:29:8
|
|
|
|
|
LL | if x != f64::INFINITY && x != f64::NEG_INFINITY {}
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
help: use the dedicated method instead
|
|
|
|
|
LL | if x.is_finite() {}
|
|
| ~~~~~~~~~~~~~
|
|
help: this will alter how it handles NaN; if that is a problem, use instead
|
|
|
|
|
LL | if x.is_finite() || x.is_nan() {}
|
|
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
help: or, for conciseness
|
|
|
|
|
LL | if !x.is_infinite() {}
|
|
| ~~~~~~~~~~~~~~~~
|
|
|
|
error: aborting due to 6 previous errors
|
|
|