mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-16 07:01:14 -03:00
Commit1fe6b28877(rustfmt.toml: specify edition to allow 2024 syntax, 2025-10-19) mentions that "cargo fmt" has different behavior than "rustfmt" before that commit. Probably because when .rustfmt.toml exists, rustfmt implicitly uses a different edition (2018?) that doesn't support c"" yet. That commit bumped the edition to 2024, which caused yet another deviation from "cargo fmt": Error writing files: failed to resolve mod `tests`: cannot parse /home/johannes/git/fish-shell/src/wutil/tests.rs error: expected identifier, found reserved keyword `gen` --> /home/johannes/git/fish-shell/src/tests/topic_monitor.rs:48:9 | 48 | for gen in &mut gens_list { | ^^^ expected identifier, found reserved keyword This has since been fixed by00784248db(Update to rust 2024 edition, 2025-10-22). Let's add a test so that such changes won't randomly break "rustfmt" again. Fix that by using 2021 edition, like we do in Cargo.toml. In future, rustfmt should probably default to a current edition (or maybe read the edition from Cargo.toml?) Not yet sure which one is the upstream issue, maybe https://github.com/rust-lang/rustfmt/issues/5650
63 lines
1.5 KiB
YAML
63 lines
1.5 KiB
YAML
name: Lint
|
|
|
|
on: [push, pull_request]
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
format:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: ./.github/actions/rust-toolchain@stable
|
|
with:
|
|
components: rustfmt
|
|
- name: install dependencies
|
|
run: pip install ruff
|
|
- name: build fish
|
|
run: cargo build
|
|
- name: check format
|
|
run: PATH="target/debug:$PATH" build_tools/style.fish --all --check
|
|
- name: check rustfmt
|
|
run: find build.rs crates src -type f -name '*.rs' | xargs rustfmt --check
|
|
|
|
|
|
clippy:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- rust_version: "stable"
|
|
features: ""
|
|
- rust_version: "stable"
|
|
features: "--no-default-features"
|
|
- rust_version: "msrv"
|
|
features: ""
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: ./.github/actions/rust-toolchain
|
|
with:
|
|
toolchain_channel: ${{ matrix.rust_version }}
|
|
components: clippy
|
|
- name: Install deps
|
|
run: |
|
|
sudo apt install gettext
|
|
- name: cargo clippy
|
|
run: cargo clippy --workspace --all-targets ${{ matrix.features }} -- --deny=warnings
|
|
|
|
rustdoc:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: ./.github/actions/rust-toolchain@stable
|
|
- name: Install deps
|
|
run: |
|
|
sudo apt install gettext
|
|
- name: cargo doc
|
|
run: |
|
|
RUSTDOCFLAGS='-D warnings' cargo doc --workspace
|
|
- name: cargo doctest
|
|
run: |
|
|
cargo test --doc --workspace
|