You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The tables below have one row per guide section, except documentation, which is split into three rows. Every in-scope row has a home: tooling covers 32 of the 62 fully or partially, and the rest are design judgment no linter can make.
Background
Guide section
Layer
Enforced by
Follow public Rust style rules
Tool, partial
rustfmt defaults, clippy's default groups (clippy::all); API Guidelines judgment in review
Apply API design rules in context
Agent + review
Decide library or application first; see AGENTS.md
Code organization
Guide section
Layer
Enforced by
Prefer small crates [chrome]
Out of scope
Chromium build rule
Use flat file layout for rust_library sources [chrome]
Out of scope
Chromium build rule
Name source files and leaf modules after the primary user-defined item
Agent + review
Don't implement APIs in non-leaf modules
Agent + review
Don't use glob imports
Tool
clippy::wildcard_imports. It already permits use Enum::* inside functions, pub use submodule::*, and use super::* in test modules. use super::* in other inline modules needs an #[expect]. Defining preludes is review-only.
A use statement should import items from one module
Qualify calls to top-level functions with a module name
Tool, partial
clippy::absolute_paths (max 2 segments) rejects crate::a::f() and std::fs::read() inline. A bare f() imported with use a::f is review-only.
Type names should be imported and used unqualified
Tool, partial
clippy::absolute_paths rejects paths of 3+ segments such as std::io::ErrorKind. Two-segment paths like regex::Regex are review-only.
Use the appropriate import mechanism [chrome]
Out of scope
chromium::import!()
Code formatting and aesthetics
Guide section
Layer
Enforced by
Use the appropriate formatting tool
Tool
rustfmt max_width = 100, hex_literal_case = "Lower", format_macro_matchers = true (the last two need nightly rustfmt); clippy::invisible_characters (deny) for unescaped invisible characters
Opting out of automatic formatting
Agent + review
#[rustfmt::skip] only for manual alignment or generated code
Ownership and borrowing
Guide section
Layer
Enforced by
Avoid Rc and Arc
Tool
clippy::disallowed_types on std::rc::Rc and std::sync::Arc. Every use needs #[expect(clippy::disallowed_types, reason = "...")], so the judgment call the guide asks for has a written reason for review.
Prefer borrows over deep copies
Tool, partial
clippy::redundant_clone, clippy::implicit_clone, clippy::needless_pass_by_value. Clones used to get past the borrow checker are review-only.
clippy::fn_params_excessive_bools and clippy::struct_excessive_bools with a threshold of one, so two or more bools fail. A single unclear bool is review-only.
Reporting errors
Agent + review
missing_panics_doc and missing_errors_doc make the chosen channel visible in docs
Types
Guide section
Layer
Enforced by
Newtypes versus type aliases
Agent + review
Prefer named fields over tuples and non-newtype tuple structs
Agent + review
Traits
Guide section
Layer
Enforced by
Add trait implementations when they become necessary
Agent + review
Implement known standard library traits instead of custom methods
Markdown, capitalization, examples, saying something the code does not
Tool, partial
clippy::doc_markdown catches unformatted code identifiers; the prose quality is review-only
Other Rust features
Guide section
Layer
Enforced by
Unsafe code
Tool, partial
clippy::undocumented_unsafe_blocks, clippy::unnecessary_safety_comment, unsafe_op_in_unsafe_fn (rustc), clippy::missing_safety_doc. Whether unsafe was necessary, and the technical justification, are review-only.