Rust Style Guide
Points and comments are a snapshot, not live.
Google's Rust style guide prioritizes readability and automation for large codebases.
The guide covers code organization, formatting, ownership, API design, traits, concurrency, macros, and naming. It emphasizes following public Rust style rules while adding Google-specific conventions for Large-Scale Changes (LSCs), such as preferring small crates, flat file layouts, and avoiding `Rc`, `Arc`, and `async`. It distinguishes library code (binding rules) from application code (strong recommendations). Sections on traits recommend adding implementations only when necessary and using `#[derive()]` where possible. No unstable features are allowed.
The guide also covers naming conventions, use of `#[non_exhaustive]` on public enums/structs, `#[must_use]` guidelines, and preferring `expect` over `unwrap`.
What commenters are saying
The dominant reaction is skepticism about the relevance of human-written style guides in an age of AI code generation. One commenter argues that guidelines should be fed to models, not read manually. Another counters that style guides remain important for readability and maintainability, especially when reviewing AI-generated code. A third notes that without automated enforcement (linters), guidelines are often ignored by both humans and agents.
A secondary discussion questions whether C and C++ are being replaced, with multiple commenters asserting that they remain dominant in defense, HPC, embedded, and large projects like Chrome, Windows, and LLVM. Some note Rust is gaining traction in newer drone companies and select niches.