lint

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Lint Skill

Lint 技能

Check code quality and formatting before committing changes.
提交代码变更前检查代码质量与格式。

Usage

使用方法

Run this skill to check for lint errors and formatting issues.
运行本技能以检查代码规范错误和格式问题。

Instructions

操作步骤

  1. Run the lint check:
    bash
    make lint
  2. If clippy reports warnings or errors, fix them before proceeding
  3. Check formatting:
    bash
    make fmt CHECK=1
  4. If formatting check fails, apply formatting:
    bash
    make fmt
  5. If license headers are missing, add them:
    bash
    cd src/redisearch_rs && cargo license-fix
  1. 运行代码规范检查:
    bash
    make lint
  2. 如果clippy报告警告或错误,请先修复再继续
  3. 检查代码格式:
    bash
    make fmt CHECK=1
  4. 如果格式检查不通过,执行格式修复:
    bash
    make fmt
  5. 如果缺少许可证头,添加许可证头:
    bash
    cd src/redisearch_rs && cargo license-fix

Common Clippy Fixes

常见Clippy修复方案

  • Document unsafe blocks: Add
    // SAFETY:
    comment explaining why the unsafe code is sound
  • Use
    #[expect(...)]
    : Prefer over
    #[allow(...)]
    for lint suppressions
  • 为unsafe块添加文档注释:添加
    // SAFETY:
    注释说明该unsafe代码安全的原因
  • 使用
    #[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