Skip to content
lake
Browse this documentation section

Rust Code Style

Style Direction

Write Rust in the style region defined by BurntSushi, dtolnay, and Niko Matsakis. This means: functional-first, iterator chains over imperative loops, combinators on Option/Result for simple transforms, match for complex branching, immutable by default, early returns with ? to keep the happy path flat.

If you’re unsure whether a pattern fits, ask: “Would BurntSushi write it this way in ripgrep?” If yes, it’s probably right. If it feels like enterprise Java, it’s probably wrong.

Toolchain Constraints

These are zero-ambiguity rules — not style preferences, but mechanical requirements.

Error Handling

Struct Construction — bon::Builder

Type Patterns

Async

Rustdoc

Code Organization