Skip to content

Commit b651f14

Browse files
committed
fix: use cargo-machete to clean up unused dependencies
1 parent 1b6ed54 commit b651f14

15 files changed

Lines changed: 26 additions & 35 deletions

File tree

.githooks/pre-push

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ if ! cargo deny check; then
88
exit 1
99
fi
1010

11+
# Unused dependency check
12+
if ! cargo machete; then
13+
echo "❌ Unused dependencies detected (run 'cargo machete')"
14+
exit 1
15+
fi
16+
1117
# Formatting check
1218
if ! cargo +nightly fmt --all -- --check; then
1319
echo "❌ Formatting issues (run 'cargo +nightly fmt --all')"

.github/workflows/dependency-audit.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,11 @@ jobs:
3030
- name: Install `cargo-deny`
3131
run: cargo install cargo-deny@0.19.0
3232

33+
- name: Install `cargo-machete`
34+
run: cargo install cargo-machete@0.9.2
35+
3336
- name: Run `cargo-deny` audit
3437
run: cargo deny check
38+
39+
- name: Run `cargo-machete`
40+
run: cargo machete

CONTRIBUTING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The easiest way to set up the development environment is using [Nix](https://nix
1010
nix develop
1111
```
1212

13-
This automatically provides all required dependencies (Rust toolchain, Protobuf, oas3-gen, cargo-deny) and configures git hooks.
13+
This automatically provides all required dependencies (Rust toolchain, Protobuf, oas3-gen, cargo-deny, cargo-machete) and configures git hooks.
1414

1515
### Manual Setup
1616

@@ -20,6 +20,7 @@ If you prefer not to use Nix, install the following manually:
2020
* [Protobuf](https://protobuf.dev/installation/)
2121
* [Docker](https://www.docker.com/)
2222
* [cargo-deny](https://github.com/EmbarkStudios/cargo-deny) - `cargo install cargo-deny@0.19.0`
23+
* [cargo-machete](https://github.com/bnjbvr/cargo-machete) - `cargo install cargo-machete@0.9.2`
2324
* [oas3-gen](https://github.com/eklipse2k8/oas3-gen) - `cargo install oas3-gen@0.24.0`
2425

2526
Then install the pre-push git hook:

Cargo.lock

Lines changed: 0 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ oas3-gen-support = "0.24"
9494
bon = "3.8"
9595
testcontainers = "0.27"
9696
test-case = "3.3"
97-
ethereum_ssz = { version = "0.10" }
98-
ethereum_ssz_derive = { version = "0.10" }
97+
ssz = { package = "ethereum_ssz", version = "0.10" }
98+
ssz_derive = { package = "ethereum_ssz_derive", version = "0.10" }
9999
tree_hash = "0.12"
100100
tree_hash_derive = "0.12"
101101
tar = "0.4"

crates/app/Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,14 @@ publish.workspace = true
1010
backon.workspace = true
1111
chrono.workspace = true
1212
pluto-core.workspace = true
13-
pluto-tracing.workspace = true
1413
pluto-eth2api.workspace = true
15-
anyhow.workspace = true
1614
tokio.workspace = true
1715
tokio-util.workspace = true
1816
prost.workspace = true
1917
prost-types.workspace = true
2018
regex.workspace = true
2119
thiserror.workspace = true
2220
tracing.workspace = true
23-
tracing-subscriber.workspace = true
2421
url.workspace = true
2522
reqwest.workspace = true
2623
serde.workspace = true

crates/cli/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ pluto-relay-server.workspace = true
2626
pluto-tracing.workspace = true
2727
pluto-core.workspace = true
2828
pluto-p2p.workspace = true
29-
pluto-eth2api.workspace = true
3029
pluto-eth2util.workspace = true
3130
pluto-k1util.workspace = true
3231
pluto-ssz.workspace = true

crates/core/Cargo.toml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,9 @@ publish.workspace = true
88

99
[dependencies]
1010
async-trait.workspace = true
11-
ethereum_ssz.workspace = true
1211
cancellation.workspace = true
1312
chrono.workspace = true
1413
crossbeam.workspace = true
15-
futures.workspace = true
16-
futures-timer.workspace = true
1714
dyn-clone.workspace = true
1815
dyn-eq.workspace = true
1916
hex.workspace = true
@@ -25,16 +22,15 @@ prost-types.workspace = true
2522
regex.workspace = true
2623
serde.workspace = true
2724
serde_json.workspace = true
28-
serde_with.workspace = true
2925
base64.workspace = true
3026
thiserror.workspace = true
3127
tokio.workspace = true
3228
tokio-util.workspace = true
3329
tracing.workspace = true
3430
pluto-eth2util.workspace = true
3531
pluto-ssz.workspace = true
32+
ssz.workspace = true
3633
tree_hash.workspace = true
37-
unsigned-varint.workspace = true
3834

3935
[dev-dependencies]
4036
anyhow.workspace = true

crates/crypto/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ hex.workspace = true
1212
pluto-eth2api.workspace = true
1313
rand.workspace = true
1414
rand_core.workspace = true
15-
serde.workspace = true
1615
thiserror.workspace = true
1716

1817
[lints.rust]

crates/eth2api/Cargo.toml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ repository.workspace = true
66
license.workspace = true
77
publish.workspace = true
88

9+
[package.metadata.cargo-machete]
10+
# `oas3-gen` writes `src/client.rs` and `src/types.rs` during build; these
11+
# dependencies are used by that generated code but absent in a fresh checkout.
12+
ignored = ["bon", "http", "oas3-gen-support", "regex", "reqwest", "validator"]
13+
914
[dependencies]
1015
anyhow.workspace = true
1116
bon.workspace = true
@@ -20,8 +25,8 @@ thiserror.workspace = true
2025
chrono.workspace = true
2126
hex.workspace = true
2227
validator.workspace = true
23-
ethereum_ssz.workspace = true
24-
ethereum_ssz_derive.workspace = true
28+
ssz.workspace = true
29+
ssz_derive.workspace = true
2530
tree_hash.workspace = true
2631
tree_hash_derive.workspace = true
2732
alloy.workspace = true

0 commit comments

Comments
 (0)