Skip to content

rustfmt incompatibility: possibly missing a comma here #3244

Closed
@Dushistov

Description

@Dushistov
pub fn f(a: i16, b: f64) -> [f64; 3] {
    const C: f64 = 100.;
    [
        b,
        -b,
        match a {
            0x17 => 1.,
            0x18 => 2.,
            _ => 3.,
        } * C
            / 60.,
    ]
}

for such code clippy (from rustup/stable | 0.0.212) clippy show error:

error: possibly missing a comma here
  --> src/lib.rs:10:14
   |
10 |         } * C
   |              ^
   |

the problem that this is default coding style from rustfmt that comes with rustup/stable compiler,
it is possible to fix if reformat code like this * C / 60. , but rustfmt doesn't allow such coding style by default.

Not sure is this rustfmt issue or clippy, but clippy and rustfmt runs on CI,
and clippy fails.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions