Antonygiomarxdev Maverick Rust Clean Code

Rust — clean code

tomevault-io 656cdbc 2 files · 1.9 KB Updated

File contents

Rust — clean code

Practical principles (community-aligned)

  • Readability over micro-optimization unless a path is measured as hot.
  • Explicit over implicit: clear return types; visible conversions (.into(), TryFrom).
  • Errors as values: propagate Result; prefer ? over nested if let Err.
  • Less shared mutable state; when it exists, keep boundaries clear (Arc, channels, or single-owner design).

Review checklist

  • Does the function fit one screen and does its name describe the observable effect?
  • Is every pub justified, or can visibility shrink?
  • Any unwrap/expect outside tests or documented invariants?
  • Do tests assert observable behavior, not brittle implementation details?

Warning signs

  • Many parameters of the same primitive type → context struct or builder.
  • Heavy clone to appease the borrow checker without revisiting API boundaries → redesign ownership at the boundary.

Source: antonygiomarxdev/maverick — distributed by TomeVault.

tomevault-io/skills-registry/tree/main/antonygiomarxdev--maverick--rust-clean-code commit 656cdbc8b0

Frequently asked questions

npx skillmds@latest add tomevault-io/antonygiomarxdev-maverick-rust-clean-code