Checklist
- Universal
- Follow the upstream guidelines (M-UPSTREAM-GUIDELINES)
- Use static verification (M-STATIC-VERIFICATION)
-
Lint overrides should use
#[expect](M-LINT-OVERRIDE-EXPECT) - Public types are Debug (M-PUBLIC-DEBUG)
- Public types meant to be read are Display (M-PUBLIC-DISPLAY)
- If in doubt, split the crate (M-SMALLER-CRATES)
- Names are free of weasel words (M-WEASEL-WORDS)
- Names of items are short (M-SHORT-NAMES)
- Prefer regular over associated functions (M-REGULAR-FN)
- Magic values are documented (M-DOCUMENTED-MAGIC)
- Use structured logging with message templates (M-LOG-STRUCTURED)
- Library / Interoperability
- Types are Send (M-TYPES-SEND)
- Native escape hatches (M-ESCAPE-HATCHES)
- Don't leak external types (M-DONT-LEAK-TYPES)
- Items come from their original crate (M-FOREIGN-REEXPORTS)
-
Accept
impl AsRef<>where feasible (M-IMPL-ASREF) -
Accept
impl RangeBounds<>where feasible (M-IMPL-RANGEBOUNDS) -
Accept
impl 'IO'where feasible ('sans IO') (M-IMPL-IO)
- Library / UX
- Abstractions don't visibly nest (M-SIMPLE-ABSTRACTIONS)
- Avoid smart pointers and wrappers in APIs (M-AVOID-WRAPPERS)
- Prefer types over generics, generics over dyn traits (M-DI-HIERARCHY)
- Errors are canonical structs (M-ERRORS-CANONICAL-STRUCTS)
-
Canonical error conversion uses
From, notmap_err(M-FROM-ERROR) - Complex type construction has builders (M-INIT-BUILDER)
- Complex type initialization hierarchies are cascaded (M-INIT-CASCADED)
- Services are Clone (M-SERVICES-CLONE)
- Essential functionality should be inherent (M-ESSENTIAL-FN-INHERENT)
- Modules are balanced in size and scope (M-BALANCED-MODULES)
- Don't define preludes (M-NO-PRELUDE)
- Parameter ordering is consistent (M-PARAMETER-CONSISTENCY)
- Collections implement the appropriate iter traits (M-COLLECTION-TRAITS)
-
Functions are
asyncover returning a Future (M-ASYNC-FN)
- Library / Resilience
- I/O and system calls are mockable (M-MOCKABLE-SYSCALLS)
- Test utilities are feature gated (M-TEST-UTIL)
-
Integration tests live under
tests/(M-INTEGRATION-TESTS) - Use the proper type family (M-STRONG-TYPES)
- Newtypes guard their invariants (M-STRONG-TYPES-GUARD)
-
Builders validate in final
.build()(M-BUILD-RESULT) - Don't glob re-export items (M-NO-GLOB-REEXPORTS)
- Avoid statics (M-AVOID-STATICS)
- Production code uses telemetry, not println (M-LOG-NOT-PRINT)
- Library / Building
- Libraries work out of the box (M-OOBE)
-
Native
-syscrates compile without dependencies (M-SYS-CRATES) - Features are additive (M-FEATURES-ADDITIVE)
- Macros
- Macros are a last resort (M-MACRO-LAST-RESORT)
- Prefer 'macros by example' over proc macros (M-EXAMPLE-OVER-PROC)
- Macros don't lie about signatures (M-MACROS-DONT-LIE)
- Macros assume main crate (M-MACRO-MAIN-CRATE)
-
Third party items come from hidden
_privatemodule (M-MACRO-HELPERS) - Proc macros should have separate impl crate incl. tests (M-PROC-IMPL)
- Proc macros don't produce implied or hidden items (M-PROC-IMPLIED-ITEMS)
- Applications
- Use mimalloc for apps (M-MIMALLOC-APPS)
- Applications may use Anyhow or derivatives (M-APP-ERROR)
- Applications target highest viable target-cpu (M-TARGET-CPU)
- FFI
- Isolate DLL state between FFI libraries (M-ISOLATE-DLL-STATE)
- Business logic belongs in core crates, FFI only translates (M-FFI-TRANSLATES)
- FFI crates follow established naming conventions (M-FFI-NAMING)
- Correctness
- Unsafe needs reason, should be avoided (M-UNSAFE)
- Unsafe implies undefined behavior (M-UNSAFE-IMPLIES-UB)
- All code must be sound (M-UNSOUND)
- Panic means 'stop the program' (M-PANIC-IS-STOP)
- Detected programming bugs are panics, not errors (M-PANIC-ON-BUG)
- Panic continuation is last resort (M-PANIC-CONTINUATION)
- Custom panics have a helpful message (M-PANIC-MESSAGE)
- Performance
- Optimize for throughput, avoid empty cycles (M-THROUGHPUT)
- Identify, profile, optimize the hot path early (M-HOTPATH)
- Long-running tasks should have yield points (M-YIELD-POINTS)
- Reuse allocations where possible (M-MEM-REUSE)
- Library telemetry does not tank performance (M-LOG-OVERHEAD)
- Nested type hierarchies should avoid needless indirection (M-AVOID-INDIRECTION)
- Use boxed slices and strings for immutable owned sequences (M-BOX-DST)
- Shrink collections to fit after building (M-SHRINK-TO-FIT)
- Use a fast hasher where possible (M-FAST-HASHER)
- Collections are created with sufficient initial capacity (M-INITIAL-CAPACITY)
-
Hot
asyncfunctions reduce stack size (M-ASYNC-STACK-SIZE)
- Project
- Common settings come from the workspace Cargo.toml (M-CARGO-WORKSPACE)
- The workspace lists and versions all crates (M-CRATES-IN-WORKSPACE)
- All crates are siblings in one folder (M-CRATES-FLAT-FOLDER)
- New crates target latest edition (M-LATEST-EDITION)
- MSRV is conservatively updated (M-MSRV)
- Documentation
- First sentence is one line; approx. 15 words (M-FIRST-DOC-SENTENCE)
- Has comprehensive module documentation (M-MODULE-DOCS)
- Documentation has canonical sections (M-CANONICAL-DOCS)
-
Mark
pub useitems with#[doc(inline)](M-DOC-INLINE)
- AI
- Design with AI use in mind (M-DESIGN-FOR-AI)
- Items are only visible through one path (M-SINGLE-ITEM-PATH)
- Avoid meta design documentation (M-NO-META-DESIGN-DOCUMENTATION)
- Tests do not assert ground truth (M-TAUTOLOGICAL-TESTS)
- Rust code solves Rust problems (M-RUST-SHAPED)