name: Code Style
on:
  pull_request:

jobs:
  codestyle:
    name: Code Style (fmt + clippy)
    runs-on: ubuntu-20.04
    steps:
    - name: Checkout repository
      uses: actions/checkout@v2
    - name: Install Rust
      uses: actions-rs/toolchain@v1
      with:
        toolchain: stable
        override: true
        profile: minimal
        components: rustfmt
    - name: Check formatting
      run: |
        cargo fmt --all -- --check
    - name: Install libudev-dev
      run: |
        sudo apt-get update
        sudo apt-get install --assume-yes libudev-dev
    - name: Check lints (cargo clippy)
      run: cargo clippy -- -D warnings

