28 lines
No EOL
805 B
Text
28 lines
No EOL
805 B
Text
### 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](https://github.com/rust-lang/rfcs/blob/master/text/0212-restore-int-fallback.md) for more information about the fallback.
|
|
|
|
### Why is this bad?
|
|
For those who are very careful about types, default numeric fallback
|
|
can be a pitfall that cause unexpected runtime behavior.
|
|
|
|
### Known problems
|
|
This lint can only be allowed at the function level or above.
|
|
|
|
### Example
|
|
```
|
|
let i = 10;
|
|
let f = 1.23;
|
|
```
|
|
|
|
Use instead:
|
|
```
|
|
let i = 10i32;
|
|
let f = 1.23f64;
|
|
``` |