lint
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseLint Skill
Lint 技能
Check code quality and formatting before committing changes.
提交代码变更前检查代码质量与格式。
Usage
使用方法
Run this skill to check for lint errors and formatting issues.
运行本技能以检查代码规范错误和格式问题。
Instructions
操作步骤
-
Run the lint check:bash
make lint -
If clippy reports warnings or errors, fix them before proceeding
-
Check formatting:bash
make fmt CHECK=1 -
If formatting check fails, apply formatting:bash
make fmt -
If license headers are missing, add them:bash
cd src/redisearch_rs && cargo license-fix
-
运行代码规范检查:bash
make lint -
如果clippy报告警告或错误,请先修复再继续
-
检查代码格式:bash
make fmt CHECK=1 -
如果格式检查不通过,执行格式修复:bash
make fmt -
如果缺少许可证头,添加许可证头:bash
cd src/redisearch_rs && cargo license-fix
Common Clippy Fixes
常见Clippy修复方案
- Document unsafe blocks: Add comment explaining why the unsafe code is sound
// SAFETY: - Use : Prefer over
#[expect(...)]for lint suppressions#[allow(...)]
- 为unsafe块添加文档注释:添加注释说明该unsafe代码安全的原因
// SAFETY: - 使用:在抑制代码规范检查时,优先使用该注解而非
#[expect(...)]#[allow(...)]
Rust-Specific Checks
Rust专属检查
For Rust-only linting:
bash
cd src/redisearch_rs && cargo clippy --all-targets --all-features针对仅Rust代码的规范检查:
bash
cd src/redisearch_rs && cargo clippy --all-targets --all-features