| Rust Style Guide(google.github.io) | |
| 378 points by kaycebasques 4 days ago | 247 comments | |
tl;dr: Google has published its internal Rust style guide, covering formatting, API design, code organization, and implementation patterns, with specific carve-outs for Chromium, Android, and Fuchsia codebases. Key opinions include preferring small crates with flat file layouts, avoiding `Rc`/`Arc` and glob imports, using `expect` over `unwrap`, favoring iterators over owned collections in library APIs, applying `#[non_exhaustive]` to public enums/structs, and banning `async`/`.await` in Chromium. The guide emphasizes readability, enabling large-scale refactors (LSCs), and consistency with the broader Rust ecosystem where possible. | |
HN Discussion:
| |