tiny-soccersim-rust/STYLE.md

49 lines
717 B
Markdown

# tssr Code Style
## Opening Braces
Opening braces always attach to the declaration line. Never on their own line.
```rust
// CORRECT
fn foo() {
if condition {
bar();
}
}
// FORBIDDEN (GNU / Allman)
fn foo()
{
if condition
{
bar();
}
}
```
## Else Statements
The `else` keyword always starts on a new line after the closing brace of the preceding block.
```rust
// CORRECT
if condition {
foo();
}
else {
bar();
}
// FORBIDDEN (1TBS / Egyptian Else)
if condition {
foo();
} else {
bar();
}
```
## Enforcement
This project uses `.rustfmt.toml` with `disable_all_formatting = true`.
Formatting is manual — follow this guide rather than relying on rustfmt.