From 71c5f038fa715a85d35501da99b130fd7accae17 Mon Sep 17 00:00:00 2001 From: oxalica Date: Wed, 16 Oct 2024 06:22:54 -0400 Subject: [PATCH] ci,contrib: check unused deps via cargo-machete --- .github/workflows/ci.yaml | 3 +++ contrib/pre-commit | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 59cc7f7..e2eb353 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -37,6 +37,9 @@ jobs: - name: Rustdoc run: cargo doc --workspace --no-deps + - name: Unused dependencies + uses: bnjbvr/cargo-machete@v0.7.0 + - name: Typos uses: crate-ci/typos@v1.26.0 diff --git a/contrib/pre-commit b/contrib/pre-commit index da74696..fcc6da9 100755 --- a/contrib/pre-commit +++ b/contrib/pre-commit @@ -1,5 +1,9 @@ #!/usr/bin/env bash set -euo pipefail -typos cargo fmt -- --check fd -e nix | xargs nixfmt --check +if ! out="$(cargo machete 2>/dev/null)"; then + echo "$out" + exit 1 +fi +typos