Google Style Guides is a documentation site hosting coding conventions for open-source projects originating at Google. Among its guides, the Rust Style Guide defines how Rust code should be organized, formatted, and designed to remain consistent and maintainable across large codebases.
The guide covers code organization such as preferring small crates and flat file layouts, formatting and aesthetics, ownership and borrowing with advice to avoid Rc and Arc where possible, and API design covering flexible references, iterators versus owned collections, and preferring enums over booleans. It also addresses error reporting and trait implementation practices.
It is intended for Rust developers, especially those working in teams or on production systems, who want authoritative conventions beyond the compiler’s defaults. Readers should already be comfortable with Rust syntax and concepts like ownership and traits.
Use it as a reference when setting up linting and formatting rules, reviewing code, or designing public APIs. Note that some rules are marked as Chrome-specific, so not every guideline applies universally. Overall, it is a concise, practical standard for writing idiomatic, scalable Rust.
评论与评分
0还没有评论,来写下第一条评价吧。