code

dtolnay

v0.1.1Skilldownload4

Enforces Rust coding style inspired by dtolnay (David Tolnay) - author of serde, syn, anyhow, thiserror

W
By wballard@mailframe.net
Updated 3 weeks ago
$mirdan install dtolnay
articleREADME

dtolnay

Rust coding style rules inspired by David Tolnay, author of serde, syn, anyhow, thiserror, proc-macro2, and many other foundational Rust crates.

These rules enforce the precise, minimal, type-driven style that dtolnay is known for. They run as edit-time validators, checking every code change in real time.

Rules

RuleWhat it enforces
parse-dont-validateUse parsing and type conversions instead of runtime validation checks
meaningful-error-messagesError types and messages must help the user fix the problem
no-stringly-typedUse enums and newtypes instead of raw strings for domain concepts
exhaustive-matchingMatch arms must be exhaustive; no wildcard catch-alls hiding bugs
precise-importsImport specific items, not glob imports
no-unnecessary-allocationDon't allocate when a borrow or slice will do
derive-orderDerive attributes must follow a canonical order
api-surface-minimalityPublic API should expose the minimum necessary surface
lifetime-elisionDon't write lifetime annotations that the compiler can infer
no-type-complexityFlatten deeply nested generic types into named type aliases
testing-as-documentationTests are the spec: named behaviors, one assert per test, trybuild for compile errors
formatting-disciplineRun cargo fmt, then check import grouping, comment style, and what rustfmt misses
test-coverage-intentEvery public fn and every error path must have a test that exercises it
test-isolation-stateTests touching files, env vars, or any stored state must be fully isolated

Installation

avp install dtolnay
historyVersion History
v0.1.11 month ago
v0.1.01 month ago