language: rust
rust:
    - stable
    - beta
    - nightly

branches:
    only:
        - master

after_script:
    - cargo install cargo-audit
    - cargo audit

language: rust
rust:
    - stable
    - beta
    - nightly

branches:
    only:
        - master

before_script:
  - rustup component add rustfmt
  - rustup component add clippy-preview
  - cargo install --force cargo-audit

script:
  - RUSTFLAGS=-Dwarnings cargo build
  - cargo clippy --all-targets -- -D warnings
  - cargo fmt --all -- --check
  - cargo audit

Put cargo audit in script instead of after_script
Put cargo audit in script instead of after_script