jinxdash / prettier-plugin-rust

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

Float formatted to int #5

Closed LeCalicot closed 2 years ago

LeCalicot commented 2 years ago

Bug Report

After installing the VS code extension and formatting it, the app wouldn't compile.

It replaced a value defined as 50.0 to 50, transforming the type from float to int.

error[E0308]: mismatched types
   --> src/app.rs:214:28
    |
214 |             .min_col_width(50)
    |              ------------- ^^
    |              |             |
    |              |             expected `f32`, found integer
    |              |             help: use a float literal: `50.0`
    |              arguments to this function are incorrect
    |
note: associated function defined here
   --> /.cargo/registry/src/github.com-1ecc6299db9ec823/egui-0.17.0/src/grid.rs:302:12
    |
302 |     pub fn min_col_width(mut self, min_col_width: f32) -> Self {
jinxdash commented 2 years ago

I can't reproduce this, 50.0 does not get replaced by 50. Can you provide the code before formatting?

LeCalicot commented 2 years ago

Actually, it may have been due to something else.