jinxdash / prettier-plugin-rust

Prettier Rust is an opinionated code formatter that autocorrects bad syntax.
MIT License
178 stars 7 forks source link

Bug: Prettier removes trailing `.` in floats #14

Closed didibear closed 2 years ago

didibear commented 2 years ago

Input code

fn main() {
    let x: f32 = 10.0;
    let y: f32 = 10.; // <-- here
}

Output code

fn main() {
    let x: f32 = 10.0;
    let y: f32 = 10; // <-- here
}

Additional context

Prettier should not remove the trailing . for floats because it is a valid syntax.

The expected format should either be 10. or 10.0.