mirror of
https://github.com/tyrchen/cursor-rust-rules.git
synced 2026-01-07 17:02:58 +00:00
feature: fix testing.mdc. bump version to 0.1.1
This commit is contained in:
@@ -169,3 +169,13 @@ async pub fn say_hello(
|
||||
6. TypedBuilder 用法遵循:并对每个字段根据情况引入 default, default_code, 以及 setter(strip_option), setter(into), 或者 setter(strip_option, into)。比如 Option<String> 要使用 `#[builder(default, setter(strip_option, into)]`. 不要滥用 default。
|
||||
|
||||
请仔细审核 @/rust rule set,看各部分内容是否有重复,是否正交,请相应修改和重构,另外,如果还有 best practice 和 rust 最佳实践和设计模式没有写进去,请添加。
|
||||
|
||||
请再次仔细审视 @/rust rules set,请确保:
|
||||
|
||||
1. rust best practices 已涵盖
|
||||
2. rust rules 是正交的,且通过 @main.mdc 可以根据不同的场景动态加载不同的 rules。
|
||||
3. 目前的子目录设置是合理的
|
||||
4. 核心规则 @/core 是合理的,且利于产生高质量且简洁的代码
|
||||
5. @/features 规则是合理的,且利于产生高质量且简洁的代码
|
||||
6. 这些 rules 无论对新项目还是老项目都能够产生高质量且简洁的代码
|
||||
如果你发现需要任何修改,请在 ./spec/ 下生成一个详细的修改计划
|
||||
|
||||
51
specs/rust-rules-review-plan.md
Normal file
51
specs/rust-rules-review-plan.md
Normal file
@@ -0,0 +1,51 @@
|
||||
## 📝 Rust Rules Review – Modification Plan
|
||||
|
||||
> Author: AI assistant
|
||||
> Date: {{DATE}}
|
||||
|
||||
### 1. Overview
|
||||
|
||||
After a thorough review of the current Rust rule-set under `.cursor/rules/rust/`, the guidelines are largely complete, orthogonal, and dynamically loadable via **`main.mdc`**. However, two gaps were identified:
|
||||
|
||||
1. **Testing best-practices module is missing.** `main.mdc` references `quality/testing.mdc`, but the file does not exist. This breaks the rule-loading table and leaves projects without unified testing standards.
|
||||
2. **`core/code-quality.mdc` lacks the mandatory decision-making Mermaid chart.** All other core/feature files now include a chart; adding one keeps the format consistent and aids discoverability.
|
||||
|
||||
No other structural issues were found. Directory layout remains logical (`core`, `features`, `quality`, `simple`, `complex`, `workflows`). Core and feature rules comprehensively cover Rust best-practices and remain orthogonal.
|
||||
|
||||
### 2. Proposed Changes
|
||||
|
||||
| # | Change | Affected File | Rationale |
|
||||
| --- | ------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| 1 | Create **`quality/testing.mdc`** with complete Rust testing standards and a decision-flow Mermaid chart | `./.cursor/rules/rust/quality/testing.mdc` | Fulfils missing reference in `main.mdc`; provides unit/integration/bench test guidelines, mocking, CI hints, coverage, property testing, etc. |
|
||||
| 2 | Add **Mermaid decision chart** to the top of **`core/code-quality.mdc`** | `./.cursor/rules/rust/core/code-quality.mdc` | Brings file in line with the "chart-first" convention adopted across the rule-set. |
|
||||
| 3 | Update module table in **`main.mdc`** (if needed) to confirm `quality/testing.mdc` exists | `./.cursor/rules/rust/main.mdc` | Keeps documentation accurate. |
|
||||
| 4 | *Optional*: add CI/CD & release workflow rules in future (`workflows/ci-cd.mdc`) – **not required immediately** but noted for roadmap | – | Complete lifecycle guidance (build, test, release) |
|
||||
|
||||
### 3. Deliverables
|
||||
|
||||
1. **`quality/testing.mdc`** – roughly 8-10 sections:
|
||||
* Testing strategy selection chart (unit vs integration vs e2e vs property vs benchmark)
|
||||
* Cargo test organisation (`#[cfg(test)]`, `/tests`, `/benches`)
|
||||
* Mocking & test doubles (`mockall`, `axum_test`, `wiremock`)
|
||||
* Async testing with Tokio
|
||||
* Property testing (`proptest`)
|
||||
* Coverage (`cargo tarpaulin`, GitHub Actions snippet)
|
||||
* Benchmarks (`criterion`)
|
||||
* CI integration checklist
|
||||
2. **Chart insertion** at top of `core/code-quality.mdc` – simple flow for adopting code-quality rules (naming, file size, lint enforcement).
|
||||
|
||||
### 4. Compatibility
|
||||
|
||||
The additions are non-breaking and purely additive:
|
||||
|
||||
* **Legacy projects** gain a clear path to adopt unified testing standards without altering existing code.
|
||||
* **New projects** continue to rely on dynamic rule loading – the missing file removal fixes table inconsistencies.
|
||||
|
||||
### 5. Next Steps
|
||||
|
||||
1. Implement the above changes via follow-up code edits.
|
||||
2. Run `cargo clippy` on representative sample projects to verify lint rules referenced still align.
|
||||
3. Regenerate rule index documentation if tooling exists.
|
||||
|
||||
---
|
||||
*End of plan*
|
||||
Reference in New Issue
Block a user