Skip to content

Commit ff5171a

Browse files
committed
fix(deps): make dependencies used only in feature-gated modules optional
- r402-svm: make `serde_json` and `tokio` optional; gate behind client/server/facilitator features; remove unused `solana-keypair` dev-dependency - r402-evm: make `alloy-sol-types` optional; gate behind client and facilitator features - r402-http: make `r402`, `serde_json`, and `thiserror` optional; gate behind client/server/telemetry features; add `use-as-underscore` for `tokio` and `wiremock` dev-dependencies Resolves `unused-crate-dependencies` errors when `-D warnings` is enabled.
1 parent a8b5fcc commit ff5171a

4 files changed

Lines changed: 20 additions & 14 deletions

File tree

r402-evm/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ all-features = true
1212
[features]
1313
default = []
1414
telemetry = ["dep:tracing", "dep:tracing-core", "r402/telemetry"]
15-
client = ["dep:alloy-signer", "dep:alloy-signer-local", "dep:rand"]
15+
client = ["dep:alloy-signer", "dep:alloy-signer-local", "dep:alloy-sol-types", "dep:rand"]
1616
client-provider = ["client", "dep:alloy-provider", "dep:alloy-rpc-types-eth"]
1717
server = []
1818
facilitator = [
@@ -23,6 +23,7 @@ facilitator = [
2323
"dep:alloy-rpc-types-eth",
2424
"dep:alloy-signer",
2525
"dep:alloy-signer-local",
26+
"dep:alloy-sol-types",
2627
"dep:alloy-transport",
2728
"dep:alloy-transport-http",
2829
"dep:async-trait",
@@ -35,7 +36,7 @@ full = ["telemetry", "client", "client-provider", "server", "facilitator"]
3536

3637
[dependencies]
3738
alloy-primitives = { workspace = true }
38-
alloy-sol-types = { workspace = true }
39+
alloy-sol-types = { workspace = true, optional = true }
3940
r402 = { workspace = true }
4041
serde = { workspace = true }
4142
serde_json = { workspace = true }

r402-http/Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ all-features = true
1111

1212
[features]
1313
default = []
14-
client = ["dep:async-trait", "dep:http", "dep:reqwest", "dep:reqwest-middleware"]
15-
server = ["dep:axum-core", "dep:http", "dep:reqwest", "dep:serde", "dep:tokio", "dep:tower", "dep:url"]
16-
telemetry = ["dep:tracing", "r402/telemetry"]
14+
client = ["dep:async-trait", "dep:http", "dep:r402", "dep:reqwest", "dep:reqwest-middleware", "dep:serde_json"]
15+
server = ["dep:axum-core", "dep:http", "dep:r402", "dep:reqwest", "dep:serde", "dep:serde_json", "dep:thiserror", "dep:tokio", "dep:tower", "dep:url"]
16+
telemetry = ["dep:r402", "dep:tracing", "r402/telemetry"]
1717
full = ["client", "server", "telemetry"]
1818

1919
[dependencies]
20-
r402 = { workspace = true }
21-
serde_json = { workspace = true }
22-
thiserror = { workspace = true }
20+
r402 = { workspace = true, optional = true }
21+
serde_json = { workspace = true, optional = true }
22+
thiserror = { workspace = true, optional = true }
2323

2424
async-trait = { workspace = true, optional = true }
2525
axum-core = { workspace = true, optional = true }

r402-http/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111
//! - `client` — reqwest-middleware for automatic 402 handling
1212
//! - `telemetry` — Tracing instrumentation
1313
14+
#[cfg(test)]
15+
use tokio as _;
16+
#[cfg(test)]
17+
use wiremock as _;
18+
1419
#[cfg(feature = "server")]
1520
pub mod server;
1621

r402-svm/Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ default = []
1414
telemetry = ["dep:tracing", "dep:tracing-core", "r402/telemetry"]
1515
client = [
1616
"dep:bincode",
17+
"dep:serde_json",
1718
"dep:solana-account",
1819
"dep:solana-client",
1920
"dep:solana-commitment-config",
@@ -25,10 +26,11 @@ client = [
2526
"dep:spl-token",
2627
"dep:spl-token-2022",
2728
]
28-
server = []
29+
server = ["dep:serde_json"]
2930
facilitator = [
3031
"dep:bincode",
3132
"dep:futures-util",
33+
"dep:serde_json",
3234
"dep:solana-account",
3335
"dep:solana-client",
3436
"dep:solana-commitment-config",
@@ -40,16 +42,17 @@ facilitator = [
4042
"dep:solana-transaction",
4143
"dep:spl-token",
4244
"dep:spl-token-2022",
45+
"dep:tokio",
4346
]
4447
full = ["telemetry", "client", "server", "facilitator"]
4548

4649
[dependencies]
4750
r402 = { workspace = true }
4851
serde = { workspace = true }
49-
serde_json = { workspace = true }
52+
serde_json = { workspace = true, optional = true }
5053
solana-pubkey = { workspace = true }
5154
thiserror = { workspace = true }
52-
tokio = { workspace = true }
55+
tokio = { workspace = true, optional = true }
5356

5457
bincode = { workspace = true, optional = true }
5558
futures-util = { workspace = true, optional = true }
@@ -67,8 +70,5 @@ spl-token-2022 = { workspace = true, optional = true }
6770
tracing = { workspace = true, optional = true }
6871
tracing-core = { workspace = true, optional = true }
6972

70-
[dev-dependencies]
71-
solana-keypair = { workspace = true }
72-
7373
[lints]
7474
workspace = true

0 commit comments

Comments
 (0)