Skip to content

Formatting

brass fmt file.brass... rewrites files in the one official layout; brass fmt --check lists files that would change and exits 1. It prints from the syntax tree, so layout is never a matter of taste: four-space indents, one statement per line, spaces around binary operators, struct fields and enum variants one per line, a single-statement match arm on the arm’s line when it fits in 100 columns. What it keeps from the source: because/todo annotations, single blank lines between statements, literal spelling ('a', 1_000, escapes, f-strings), x += 1, and whether a struct literal spans lines. It adds parentheses where precedence needs them. The compiler’s own source is checked by make test.