Skip to content

Collapses array of tuples #6732

@Xotchkass

Description

@Xotchkass

I use following rustfmt args:

max_width=125, fn_single_line=true, trailing_semicolon=true, overflow_delimited_expr=true, single_line_if_else_max_width=100, single_line_let_else_max_width=100, enum_discrim_align_threshold=100, short_array_element_width_threshold=40, trailing_comma=never 

and so I would expect

const P3_INPUT: &[(u64, u64)] = &[(631, 631), (626, 626), (622, 622), (604, 604), (593, 2372), (581, 581), (563, 1689), (552, 552), (537, 1611),(532, 532), (524, 1048), (521, 521), (504, 2016), (496, 496), (490, 1960), (479, 479), (475, 950), (463, 463),(446, 446), (432, 432), (413, 413), (408, 408), (405, 1215), (389, 389), (378, 1134), (370, 370), (366, 1098),(271, 271), (265, 265), (255, 510), (242, 242), (240, 240), (225, 225), (221, 663), (206, 206), (190, 570),(187, 187), (168, 672), (164, 164), (149, 298), (130, 130), (127, 127), (88, 88)];

to get formatted like:

const P3_INPUT: &[(u64, u64)] = &[ (631, 631), (626, 626), (622, 622), (604, 604), (593, 2372), (581, 581), (563, 1689), (552, 552), (537, 1611), (532, 532), (524, 1048), (521, 521), (504, 2016), (496, 496), (490, 1960), (479, 479), (475, 950), (463, 463), (446, 446), (432, 432), (413, 413), (408, 408), (405, 1215), (389, 389), (378, 1134), (370, 370), (366, 1098), (271, 271), (265, 265), (255, 510), (242, 242), (240, 240), (225, 225), (221, 663), (206, 206), (190, 570), (187, 187), (168, 672), (164, 164), (149, 298), (130, 130), (127, 127), (88, 88) ];

in the same way as it formats arrays of normal literals:

const P2_INPUT: &[u64] = &[ 966, 957, 953, 944, 923, 910, 894, 867, 852, 833, 819, 806, 782, 765, 745, 727, 716, 711, 691, 686, 662, 639, 633, 614, 601, 580, 578, 577, 561, 557, 543, 533, 507, 491, 485, 474, 467, 455, 433, 429, 406, 401, 378, 361, 354, 332, 330, 314, 305, 277, ];

But it instead collapses into one-per-line format:

const P3_INPUT: &[(u64, u64)] = &[ (631, 631), (626, 626), (622, 622), (604, 604), (593, 2372), (581, 581), (563, 1689), (552, 552), (537, 1611), (532, 532), (524, 1048), (521, 521), (504, 2016), (496, 496), (490, 1960), (479, 479), (475, 950), (463, 463), (446, 446), (432, 432), (413, 413), (408, 408), (405, 1215), (389, 389), (378, 1134), (370, 370), (366, 1098), (271, 271), (265, 265), (255, 510), (242, 242), (240, 240), (225, 225), (221, 663), (206, 206), (190, 570), (187, 187), (168, 672), (164, 164), (149, 298), (130, 130), (127, 127), (88, 88), ];

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