What problem does it solve?
This Skill ensures that Rust code adheres to best practices, preventing common pitfalls related to ownership, error handling, and performance. It helps developers write cleaner, safer, and more efficient Rust, reducing debugging time and improving overall code quality and maintainability.
Core Features & Use Cases
- Idiomatic Error Handling: Guides on using
thiserror for libraries and anyhow for applications, avoiding generic Box<dyn Error> for clearer error types.
- Ownership & Borrowing Patterns: Provides solutions for common ownership "gotchas" like partial and overly broad borrows, ensuring efficient and safe memory management.
- Performance & Security: Offers advice on profiling, inlining tiny functions, enabling checked arithmetic, validating external input, and using
cargo-audit for dependency vulnerability checks.
- Use Case: Review an existing Rust codebase to identify and refactor anti-patterns, ensuring it follows modern Rust idioms for better maintainability, security, and performance.
Quick Start
Review the attached Rust code for common anti-patterns related to ownership and error handling, and suggest improvements to make it more idiomatic.