It can be quite challenging to maintain an appropriately consistent style when writing code snippets for examples. Indentation errors, offset parentheses and so on reduce the perception of quality to new readers, and distract from the learning experience.
Fortunately, cargo fmt is very good. We should ensure that submitted code passes cargo fmt. This is very closely related to #83, and we should ensure that the solution we select for that can be extended to fit this.
Ideally, this process is also easy for authors to use. We probably won't be able to use cargo fmt directly, as the Rust files are embedded inside markdown, but a script that applies the formatting to all code blocks and can be run on command would be massively appreciated.
It can be quite challenging to maintain an appropriately consistent style when writing code snippets for examples. Indentation errors, offset parentheses and so on reduce the perception of quality to new readers, and distract from the learning experience.
Fortunately,
cargo fmtis very good. We should ensure that submitted code passescargo fmt. This is very closely related to #83, and we should ensure that the solution we select for that can be extended to fit this.Ideally, this process is also easy for authors to use. We probably won't be able to use
cargo fmtdirectly, as the Rust files are embedded inside markdown, but a script that applies the formatting to all code blocks and can be run on command would be massively appreciated.