rust-general
General Rust rules for safe, idiomatic application and library development.
- Kind
- Rules
- Works with
- Cursor
- Languages
- Rust
- Source
- Awesome Cursor Rules @ b044f956f021
- Path
- rules/rust-general.mdc
- Jobs
- Implementation
Credit
- Made by
- PatrickJS
- Original
- github.com/PatrickJS/awesome-cursorrules/blob/b044f956f021b6e…
- License
- CC0-1.0
Listed by Skill Manifest; not made by us.
InstallCopy it from the source repository, or sign in and let the assistant adapt it for your project.
Install factsScanned 3 Nov 2026
- Adds
- Text to merge into your CLAUDE.md or AGENTS.md (no new files)
- Runs scripts
- None found
- Uses the network
- None found
- Needs secrets
- None found
- Source revision
- b044f956f021
- Licence
- CC0-1.0
- Last activity
- 30 May 2026
- Review
- Reviewed
Found by a static scan of the stored text; nothing is run. “None found” is not a guarantee, so read what you install before you run it.
# Rust General Rules ## Project Structure - Keep crates focused and name modules by domain responsibility. - Put reusable library code in `src/lib.rs` and binary entry points in `src/main.rs` or `src/bin/`. - Keep public APIs small and documented. - Use feature flags deliberately and document non-default features. - Commit `Cargo.lock` for applications; follow the project convention for libraries. ## Ownership and Types - Prefer borrowing over cloning when ownership is not needed. - Use owned values at API boundaries when the callee must store data. - Model domain states with enums and structs instead of strings or booleans. - Use `Option<T>` for absence and `Result<T, E>` for fallible operations. - Avoid `unwrap()` and `expect()` outside tests, examples, and process-startup invariants. ## Error Handling - Use `thiserror` or project-standard custom errors for libraries. - Use `anyhow` or project-standard context-rich errors for applications. - Add context when crossing IO, network, database, or parsing boundaries. - Do not discard errors with `_` unless explicitly documented. ## Concurrency and Async - Use `Send` and `Sync` boundaries intentionally. …