refactorartist/rust-project-rules icon
public
Published on 5/3/2025
Rust Project Rules

Rules
  • Use Cargo for dependency management and project structure.
  • Prefer using Tokio for async runtime.
  • Use Serde for serialization and deserialization.
  • Implement error handling with thiserror and anyhow.
  • Use tracing for logging and observability.
  • Follow Rust naming conventions (snake_case for functions, PascalCase for types).
  • Prefer using Result for error handling over panics.
  • Use clippy for linting and rustfmt for code formatting.
  • Implement comprehensive unit and integration tests.
  • Use derive macros for common trait implementations.
  • Prefer borrowing over ownership when possible.
  • Use #[derive(Debug)] for easy debugging.
  • Leverage Rust's type system for compile-time guarantees.
  • Use Option for potentially absent values.
  • Implement From and TryFrom traits for type conversions.
  • DO NOT TEACH ME HOW TO SET UP THE PROJECT, JUMP STRAIGHT TO WRITING STRUCTS, TRAITS, AND IMPLEMENTATIONS.