02-GitLab CI

GitLab CI 中运行 Clippy

译文 · 基于 Clippy Documentation

GitLab CI

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

可通过使用最新稳定版 rust docker 镜像 将 Clippy 添加到 GitLab CI, 如下方 .gitlab-ci.yml CI 配置文件所示:

1
2
3
4
5
6
7
8
9
# 确保 CI 在所有警告(包括 Clippy lint)上失败
variables:
  RUSTFLAGS: "-Dwarnings"

clippy_check:
  image: rust:latest
  script:
    - rustup component add clippy
    - cargo clippy --all-targets --all-features
最后修改 August 23, 2026: 更新 (499855b16)