jobs:
  # Check formatting
  - job: ${{ parameters.name }}
    displayName: Check rustfmt
    pool:
      vmImage: ubuntu-16.04
    steps:
      - template: azure-install-rust.yml
        parameters:
          rust_version: stable
      - script: |
          rustup component add rustfmt
        displayName: Install rustfmt
      - script: |
          cargo fmt --all -- --check
        displayName: Check formatting

jobs:
  # Check formatting
  - job: ${{ parameters.name }}
    displayName: Check rustfmt
    pool:
      vmImage: ubuntu-16.04
    steps:
      - template: azure-install-rust.yml
        parameters:
          rust_version: stable
      - script: |
          rustup component add rustfmt
        displayName: Install rustfmt
      - script: |
          # FIXME: for some reason this doesn't actually check all files.
          # So instead we run `rustfmt` directly on each file.
          #cargo fmt --all -- --check
          find src tests examples -type f -iname "*.rs" | xargs rustfmt --check
        displayName: Check formatting

Fix checking of rusfmted files on CI
Fix checking of rusfmted files on CI
