Formating with rustfmt direcly

Is rustfmt can layout array memeber line like this.

from :


const SineTable80: [FIXP_STP; 41] = [
    [32767, 0],
    [32762, 643],
    [32743, 1286],
    [32711, 1929],
    [32667, 2571],
    [32610, 3212],
    [32541, 3851],
    [32459, 4490],
    [32365, 5126],
    [32258, 5760],
    [32138, 6393],
    [32007, 7022],
    [31863, 7650],
    [31706, 8274],
    [31538, 8895],
    [31357, 9512],
    [31164, 10126],
    [30959, 10736],
    [30743, 11342],
    [30514, 11943],
    [30274, 12540],
    [30022, 13132],
    [29758, 13719],
    [29483, 14300],
    [29197, 14876],
    [28899, 15447],
    [28590, 16011],
    [28270, 16569],
    [27939, 17121],
    [27598, 17666],
    [27246, 18205],
    [26883, 18736],
    [26510, 19261],
    [26127, 19777],
    [25733, 20286],
    [25330, 20788],
    [24917, 21281],
    [24494, 21766],
    [24062, 22243],
    [23621, 22711],
    [23170, 23170],
];

to

const SineTable80: [FIXP_STP; 41] = [
    [32767, 0], [32762, 643], [32743, 1286], [32711, 1929],
    [32667, 2571], [32610, 3212], [32541, 3851], [32459, 4490],
    [32365, 5126], [32258, 5760], [32138, 6393], [32007, 7022],
    [31863, 7650], [31706, 8274], [31538, 8895], [31357, 9512],
    [31164, 10126], [30959, 10736], [30743, 11342], [30514, 11943],
    [30274, 12540], [30022, 13132], [29758, 13719], [29483, 14300],
    [29197, 14876], [28899, 15447], [28590, 16011], [28270, 16569],
    [27939, 17121], [27598, 17666], [27246, 18205], [26883, 18736],
    [26510, 19261], [26127, 19777], [25733, 20286], [25330, 20788],
    [24917, 21281], [24494, 21766], [24062, 22243],[23621, 22711],
    [23170, 23170],
];

If you paste code into https://play.rust-lang.org, you can apply rustfmt to it under the tools menu, if you want to see how it behaves.

1 Like