cursor / claude rules

Rust Cursor Rules

Cursor rules for Rust projects. Ownership patterns, error handling with Result/Option, and idiomatic Rust.
by cache.directory updated May 18, 2026 CC-BY-4.0

## what it does

.cursorrules for Rust

# Rust Project Rules

## Error Handling
- Use Result<T, E> for fallible operations, never panic
- Use thiserror for custom error types
- Use anyhow for application-level errors
- Use ? operator for propagation

## Ownership
- Prefer borrowing (&T) over cloning
- Use Cow<str> when ownership is conditional
- Minimize Arc/Mutex — redesign to avoid shared state

## Style
- Follow Rust API Guidelines
- cargo fmt and cargo clippy with no warnings
- Document all public items with /// doc comments
- Use #[must_use] on functions that return important values

## Testing
- Unit tests in #[cfg(test)] mod at bottom of file
- Integration tests in tests/ directory
- Use assert_eq! with descriptive messages

## Dependencies
- Minimize dependencies — prefer std library
- Pin major versions in Cargo.toml
- Use features to keep builds lean

## embed this badge

cache ✓ in cache.directory
![cached](https://cache.directory/badge/rust-cursor-rules.svg)