name: Clippy

on:
  merge_group:
  pull_request:
  push:
    branches:
      - main

env:
  FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true

jobs:
  clippy:
    name: Runs "cargo clippy"
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v6

      - uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: stable
          components: clippy

      - name: Cache .cargo
        uses: actions/cache@v5
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
          key: cargo-clippy-${{ hashFiles('**/Cargo.toml') }}

      - name: cargo clippy
        run: cargo clippy --all --all-features -- -D warnings