1 # Guiding principles and rationale
3 When deciding on style guidelines, the style team tried to be guided by the
4 following principles (in rough priority order):
8 - avoiding misleading formatting
9 - accessibility - readable and editable by users using the the widest
10 variety of hardware, including non-visual accessibility interfaces
11 - readability of code when quoted in rustc error messages
15 - consistent with other languages/tools
18 - compatibility with version control practices - preserving diffs,
19 merge-friendliness, etc.
20 - preventing right-ward drift
21 - minimising vertical space
24 - ease of manual application
25 - ease of implementation (in Rustfmt, and in other tools/editors/code generators)
26 - internal consistency
27 - simplicity of formatting rules
30 ## Overarching guidelines
32 Prefer block indent over visual indent. E.g.,
46 This makes for smaller diffs (e.g., if `a_function_call` is renamed in the above
47 example) and less rightward drift.
49 Lists should have a trailing comma when followed by a newline, see the block
50 indent example above. This choice makes moving code (e.g., by copy and paste)
51 easier and makes smaller diffs.