From 6c89c0d1d2a28abf55a0c8c1f40e54c3c3ca48e6 Mon Sep 17 00:00:00 2001 From: giladchase Date: Tue, 28 May 2024 14:07:45 +0300 Subject: [PATCH] chore: switch from udeps to machete (#178) Seems like machete much faster and catches more stuff (see examples below). Note: machete uses a regex basically, so there might be false-positives down the line, if this happens add: ``` [package.metadata.cargo-machete] ignored = ["package_that_machete_thinks_isnt_being_used"] ``` Co-Authored-By: Gilad Chase --- .github/workflows/ci.yml | 14 +++----------- Cargo.lock | 8 -------- crates/gateway/Cargo.toml | 2 -- crates/mempool_infra/Cargo.toml | 3 --- crates/mempool_node/Cargo.toml | 4 ---- 5 files changed, 3 insertions(+), 28 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 699802a8a..62c7cf4fe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -64,17 +64,9 @@ jobs: - uses: Swatinem/rust-cache@v2 - run: cargo test - udeps: + unused-dependencies: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: dtolnay/rust-toolchain@master - with: - toolchain: nightly-2024-01-12 - - uses: Swatinem/rust-cache@v2 - - name: Install udeps, should be cached unless `Cargo.{toml.lock}` or this workflow change - uses: baptiste0928/cargo-install@v3 - with: - crate: cargo-udeps - - name: Run udeps (detect unused dependencies) - run: cargo udeps + - name: Run Machete (detect unused dependencies) + uses: bnjbvr/cargo-machete@main diff --git a/Cargo.lock b/Cargo.lock index fc517fd41..031373821 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1978,11 +1978,9 @@ version = "0.0.0" dependencies = [ "assert_matches", "async-trait", - "clap", "papyrus_config", "pretty_assertions", "serde", - "serde_json", "thiserror", "tokio", ] @@ -1992,16 +1990,12 @@ name = "mempool_node" version = "0.0.0" dependencies = [ "assert_matches", - "async-trait", "clap", "const_format", "papyrus_config", "pretty_assertions", "serde", - "serde_json", - "starknet_api", "starknet_gateway", - "thiserror", "tokio", "validator", ] @@ -3200,7 +3194,6 @@ dependencies = [ "axum", "blockifier", "cairo-lang-starknet-classes", - "clap", "hyper", "mempool_infra", "papyrus_config", @@ -3215,7 +3208,6 @@ dependencies = [ "thiserror", "tokio", "tower", - "url", "validator", ] diff --git a/crates/gateway/Cargo.toml b/crates/gateway/Cargo.toml index 709682463..2dc57af05 100644 --- a/crates/gateway/Cargo.toml +++ b/crates/gateway/Cargo.toml @@ -15,7 +15,6 @@ testing = [] axum.workspace = true blockifier.workspace = true cairo-lang-starknet-classes.workspace = true -clap.workspace = true hyper.workspace = true mempool_infra = { path = "../mempool_infra", version = "0.0" } papyrus_config.workspace = true @@ -27,7 +26,6 @@ starknet_mempool_types = { path = "../mempool_types", version = "0.0" } thiserror.workspace = true tokio.workspace = true tower.workspace = true -url.workspace = true validator.workspace = true [dev-dependencies] diff --git a/crates/mempool_infra/Cargo.toml b/crates/mempool_infra/Cargo.toml index f82353dd8..5e8f67019 100644 --- a/crates/mempool_infra/Cargo.toml +++ b/crates/mempool_infra/Cargo.toml @@ -13,9 +13,7 @@ workspace = true [dependencies] async-trait.workspace = true -clap.workspace = true serde.workspace = true -serde_json.workspace = true papyrus_config.workspace = true thiserror.workspace = true tokio.workspace = true @@ -23,4 +21,3 @@ tokio.workspace = true [dev-dependencies] assert_matches.workspace = true pretty_assertions.workspace = true - diff --git a/crates/mempool_node/Cargo.toml b/crates/mempool_node/Cargo.toml index 9f9a8612d..f63d6b28e 100644 --- a/crates/mempool_node/Cargo.toml +++ b/crates/mempool_node/Cargo.toml @@ -9,14 +9,10 @@ license.workspace = true workspace = true [dependencies] -async-trait.workspace = true clap.workspace = true const_format.workspace = true starknet_gateway = { path = "../gateway", version = "0.0" } serde.workspace = true -serde_json.workspace = true -starknet_api.workspace = true -thiserror.workspace = true papyrus_config.workspace = true tokio.workspace = true validator.workspace = true