Skip to content

Formatting of Code in Book is Sometimes Inconsistent with rustfmt #1690

@JosephTLyons

Description

@JosephTLyons

I've been reading the Rust book much more recently and have come to notice that some examples do not follow the way in which rustfmt formats code. For example, in the Method Syntax chapter of the book, an instance of the Rectangle struct is formatted as such:

let rect1 = Rectangle { width: 30, height: 50 };

but rustfmt would format it as such:

let rect1 = Rectangle {
        width: 30,
        height: 50,
};

I've found other discrepancies between the book's formatting and rustfmt. Rustfmt seems to be a tool that was made to help Rustaceans put their code in the exact format agreed upon by the creators, so I think it would be fit to format the code in the book with rustfmt. If there is any interest in this happening, but the task is considered large, I would be happy to help.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions