CursorRustCode Style

Rust Cursor Rules

Cursor rules for Rust: ownership patterns, error handling with Result, idiomatic Rust, and performance-aware coding conventions.

.cursorrules
- Use Result<T, E> for all fallible operations; propagate with the ? operator
- Prefer returning errors over panicking; reserve panic! for truly unrecoverable states
- Use thiserror for library errors and anyhow for application errors
- Leverage the type system to make invalid states unrepresentable
- Prefer iterators and combinators over imperative loops
- Use clippy and rustfmt in CI; treat clippy warnings as errors
- Document all public items with doc comments including examples
- Use #[derive] for common traits (Debug, Clone, PartialEq, serde)

How to use with Cursor

Create a `.cursorrules` file in your project root and paste these rules. Cursor reads this automatically on every AI interaction.

#rust#ownership#result#cursor#coding-rules

Related Rules