01-GitHub Actions

GitHub Actions 中运行 Clippy

译文 · 基于 Clippy Documentation

GitHub Actions

原文链接: https://doc.rust-lang.org/nightly/clippy/continuous_integration/github_actions.html

使用最新稳定版 Rust 的 GitHub 托管 runner 已预装 Clippy。 只需运行 cargo clippy 即可对代码库运行 lint。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
on: push
name: Clippy check

# 确保 CI 在所有警告(包括 Clippy lint)上失败
env:
  RUSTFLAGS: "-Dwarnings"

jobs:
  clippy_check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - name: Run Clippy
        run: cargo clippy --all-targets --all-features
最后修改 August 23, 2026: 更新 (499855b16)