Rust is very nitpicky about use of integer literals where floating point types are expected.
let x: (f64,f64) = (0,0); // Not allowed let x: (f64,f64) = (0.0,0.0); // Not as readable
if y > 0 // not allowed for f64 :(
error: mismatched types: expected
_(expected f64, found integral variable)
I don’t see any harm in allowing implicit conversion from integral literal to floating point type if the value fits without loss of precision. I think it would allow avoiding unnecessary noise in the code and save me from frequent compilation errors where I forget a “decorative”
The abundance of
.0 also makes code less clear when working with tuples:
1.0 + p.0
BTW: the widening discussion doesn’t seem to cover integer > float conversions. Should it?