fix: 💚 修复代码以通过CI clippy测试 #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
# 🔗CI语法参考:https://docs.github.com/zh/actions/writing-workflows/workflow-syntax-for-github-actions | |
# ! 📌【2024-09-13 23:41:22】不建议在`name`中附带空格:会影响到shields.io中的badge链接 | |
on: | |
push: # 推送到特定分支 | |
branches: | |
- main | |
- dev | |
- 'test**' | |
label: # 创建标签 | |
types: | |
- created | |
pull_request: # 拉取请求 | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build_and_test: | |
name: Build and Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: Swatinem/rust-cache@v2 | |
- name: setup toolchain | |
uses: hecrj/setup-rust-action@v1 | |
with: | |
rust-version: stable | |
- name: cargo test | |
run: cargo test --all-features | |
- name: rustfmt | |
run: cargo fmt --all -- --check | |
- name: clippy | |
run: cargo clippy --all --all-features --tests -- -D warnings | |
# 📌【2024-08-25 00:23:12】暂不启用``参数:暂且不对clippy采取过于严格的限制 | |
# 📝【2024-08-25 00:33:21】现在可在Cargo.toml中 允许特定clippy限制(诸如:放宽对文档注释的要求) |