Member-only story
I Read Google’s Internal Rust Style Guide: 3 Rules to Steal, 4 to Question
Google’s Rust rules come from huge codebases like Android and Chromium. Some are great for any project, and some only make sense at that scale.
Google has published its internal Rust style guide, and I spent time going through it with one question in mind: which rules should I use in my own projects?
Some rules made me think, “I should have been doing this already.” Others only make sense if you work on a codebase with thousands of engineers. A few go against what many Rust developers consider normal.
Here is my breakdown, with my opinion on each rule.
First, the Context
Three things help explain the rules:
1. It is not only about formatting. The guide also covers API design and implementation choices, which is more useful than a list of where to put your braces.
2. It was written for very large codebases. Google’s examples are Android and Chromium. A rule that makes sense for those projects may be too much for your side project or small startup.
3. It has clear goals. The rules favor readability and maintainability over how fast code…










