diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index e31930a..71440cb 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -72,8 +72,20 @@ jobs: lint-${{ runner.os }}-cargo-${{ matrix.target }}- ${{ runner.os }}-cargo-${{ matrix.target }}- + - name: Install cargo-sort + run: cargo install cargo-sort || exit 0 + if: matrix.target != 'x86_64-pc-windows-msvc' + + # ----- Actual linting logic ------ + # These lines should mirror the `just lint` command. - name: cargo fmt - run : cargo fmt --all -- --check + run: cargo fmt --all -- --check + + - name: cargo sort + run: cargo sort --workspace --check + # Don't run cargo-sort on windows, as the formatting behavior seems to be slightly different: + # https://github.com/DevinR528/cargo-sort/issues/56 + if: matrix.target != 'x86_64-pc-windows-msvc' - name: cargo clippy run: cargo clippy --tests --workspace -- -D warnings diff --git a/Justfile b/Justfile index 42f468d..1fceaef 100644 --- a/Justfile +++ b/Justfile @@ -10,11 +10,12 @@ nextest: just ensure_installed nextest cargo nextest run --workspace +# If you change anything in here, make sure to also adjust the lint CI job! lint: just ensure_installed sort - cargo fmt --check + cargo fmt --all -- --check cargo sort --workspace --check - cargo clippy --all --tests + cargo clippy --tests --workspace -- -D warnings format: just ensure_installed sort