RS.CLIPPY.DEFAULT_NUMERIC_FALLBACK
Usage of unconstrained numeric literals which may cause default numeric fallback.
This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: default_numeric_fallback. Copyright ©2025 The Rust Team. All rights reserved.
What it does
Checks for usage of unconstrained numeric literals which may cause default numeric fallback in type inference.
Default numeric fallback means that if numeric types have not yet been bound to concrete
types at the end of type inference, then integer type is bound to i32, and similarly
floating type is bound to f64.
See RFC0212 for more information about the fallback.
Why restrict this?
To ensure that every numeric type is chosen explicitly rather than implicitly.
Known problems
This lint is implemented using a custom algorithm independent of rustc's inference, which results in many false positives and false negatives.
Example
let i = 10;
let f = 1.23;
Use instead:
let i = 10_i32;
let f = 1.23_f64;