I often use integer type without type annotation:
let mut counter = 0
If there is no constraint, rustc will infer x is a i32. (rfcs/0212-restore-int-fallback.md at master · rust-lang/rfcs).
Sometimes it causes a problem: overflowing.
for _ in 0..1_000_000_000_000usize {
counter += 1; # overflow!
...
}
So I want to tell rustc to deny integer variable without explicit type annotation:
let mut counter = 0; # Deny
let mut counter: u64 = 0; # OK, because `counter` is explicitly annotated with `u64`
How to do this?