RS.CLIPPY.MANUAL_IS_FINITE

Use dedicated method to check if a float is finite

This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: manual_is_finite. Copyright ©2025 The Rust Team. All rights reserved.

What it does

Checks for manual is_finite reimplementations (i.e., x != <float>::INFINITY && x != <float>::NEG_INFINITY).

Why is this bad?

The method is_finite is shorter and more readable.

Example

if x != f32::INFINITY && x != f32::NEG_INFINITY {}
if x.abs() < f32::INFINITY {}

Use instead:

if x.is_finite() {}
if x.is_finite() {}