Improve hir_pretty for struct expressions. by m-ou-se · Pull Request #139132 · rust-lang/rust (original) (raw)

Rollup merge of rust-lang#139132 - m-ou-se:hir-pp-struct-expr, r=compiler-errors

Improve hir_pretty for struct expressions.

While working on rust-lang#139131 I noticed the hir pretty printer outputs an empty line between each field, and is also missing a space before the { and the }:

    let a =
        StructWithSomeFields{
            field_1: 1,

            field_2: 2,

            field_3: 3,

            field_4: 4,

            field_5: 5,

            field_6: 6,};

    let a = StructWithSomeFields{ field_1: 1,  field_2: 2, ..a};

This changes it to:

    let a =
        StructWithSomeFields {
            field_1: 1,
            field_2: 2,
            field_3: 3,
            field_4: 4,
            field_5: 5,
            field_6: 6 };

    let a = StructWithSomeFields { field_1: 1, field_2: 2, ..a };