Skip to content

Commit e38b298

Browse files
committed
refactor: use const instead of lazy_static ref
Signed-off-by: Lorenzo Delgado <[email protected]>
1 parent ccddf38 commit e38b298

File tree

18 files changed

+114
-121
lines changed

18 files changed

+114
-121
lines changed

crates/attestation/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ mod tests {
196196
INDEXER_OPERATOR_MNEMONIC,
197197
&allocation,
198198
1,
199-
*DISPUTE_MANAGER_ADDRESS
199+
DISPUTE_MANAGER_ADDRESS
200200
)
201201
.unwrap()
202202
.signer
@@ -241,7 +241,7 @@ mod tests {
241241
INDEXER_OPERATOR_MNEMONIC,
242242
&allocation,
243243
1,
244-
*DISPUTE_MANAGER_ADDRESS
244+
DISPUTE_MANAGER_ADDRESS
245245
)
246246
.is_err());
247247
}

crates/monitor/src/attestation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ mod tests {
8888
#[tokio::test]
8989
async fn test_attestation_signers_update_with_allocations() {
9090
let (allocations_tx, allocations_rx) = watch::channel(HashMap::new());
91-
let (_, dispute_manager_rx) = watch::channel(*DISPUTE_MANAGER_ADDRESS);
91+
let (_, dispute_manager_rx) = watch::channel(DISPUTE_MANAGER_ADDRESS);
9292
let mut signers = attestation_signers(
9393
allocations_rx,
9494
INDEXER_MNEMONIC.clone(),

crates/monitor/src/client/subgraph_client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ mod test {
270270
let mock = Mock::given(method("POST"))
271271
.and(path(format!(
272272
"/subgraphs/id/{}",
273-
*test_assets::NETWORK_SUBGRAPH_DEPLOYMENT
273+
test_assets::NETWORK_SUBGRAPH_DEPLOYMENT
274274
)))
275275
.respond_with(ResponseTemplate::new(200).set_body_raw(
276276
r#"

crates/monitor/src/dispute_manager.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ mod test {
5353
DeploymentDetails::for_query_url(&format!(
5454
"{}/subgraphs/id/{}",
5555
&mock_server.uri(),
56-
*test_assets::NETWORK_SUBGRAPH_DEPLOYMENT
56+
test_assets::NETWORK_SUBGRAPH_DEPLOYMENT
5757
))
5858
.unwrap(),
5959
)
@@ -65,10 +65,10 @@ mod test {
6565
Mock::given(method("POST"))
6666
.and(path(format!(
6767
"/subgraphs/id/{}",
68-
*test_assets::NETWORK_SUBGRAPH_DEPLOYMENT
68+
test_assets::NETWORK_SUBGRAPH_DEPLOYMENT
6969
)))
7070
.respond_with(ResponseTemplate::new(200).set_body_json(
71-
json!({ "data": { "graphNetwork": { "disputeManager": *DISPUTE_MANAGER_ADDRESS }}}),
71+
json!({ "data": { "graphNetwork": { "disputeManager": DISPUTE_MANAGER_ADDRESS }}}),
7272
)),
7373
)
7474
.await;
@@ -85,6 +85,6 @@ mod test {
8585
.unwrap();
8686
sleep(Duration::from_millis(50)).await;
8787
let result = *dispute_manager.borrow();
88-
assert_eq!(result, *DISPUTE_MANAGER_ADDRESS);
88+
assert_eq!(result, DISPUTE_MANAGER_ADDRESS);
8989
}
9090
}

crates/monitor/src/escrow_accounts.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ mod tests {
202202
DeploymentDetails::for_query_url(&format!(
203203
"{}/subgraphs/id/{}",
204204
&mock_server.uri(),
205-
*test_assets::ESCROW_SUBGRAPH_DEPLOYMENT
205+
test_assets::ESCROW_SUBGRAPH_DEPLOYMENT
206206
))
207207
.unwrap(),
208208
)
@@ -212,7 +212,7 @@ mod tests {
212212
let mock = Mock::given(method("POST"))
213213
.and(path(format!(
214214
"/subgraphs/id/{}",
215-
*test_assets::ESCROW_SUBGRAPH_DEPLOYMENT
215+
test_assets::ESCROW_SUBGRAPH_DEPLOYMENT
216216
)))
217217
.respond_with(
218218
ResponseTemplate::new(200)
@@ -222,7 +222,7 @@ mod tests {
222222

223223
let mut accounts = escrow_accounts(
224224
escrow_subgraph,
225-
*test_assets::INDEXER_ADDRESS,
225+
test_assets::INDEXER_ADDRESS,
226226
Duration::from_secs(60),
227227
true,
228228
)

crates/service/src/middleware/allocation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ mod tests {
7575

7676
#[tokio::test]
7777
async fn test_allocation_middleware() {
78-
let deployment = *ESCROW_SUBGRAPH_DEPLOYMENT;
78+
let deployment = ESCROW_SUBGRAPH_DEPLOYMENT;
7979
let deployment_to_allocation =
8080
watch::channel(vec![(deployment, Address::ZERO)].into_iter().collect()).1;
8181
let state = AllocationState {

crates/service/src/middleware/attestation_signer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ mod tests {
5555
let allocation = **allocations.keys().collect::<Vec<_>>().first().unwrap();
5656

5757
let (_, allocations_rx) = watch::channel(allocations);
58-
let (_, dispute_manager_rx) = watch::channel(*DISPUTE_MANAGER_ADDRESS);
58+
let (_, dispute_manager_rx) = watch::channel(DISPUTE_MANAGER_ADDRESS);
5959
let attestation_signers = attestation_signers(
6060
allocations_rx,
6161
INDEXER_MNEMONIC.clone(),

crates/service/src/middleware/deployment.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ mod tests {
3838
async fn test_deployment_middleware() {
3939
let middleware = from_fn(deployment_middleware);
4040

41-
let deployment = *ESCROW_SUBGRAPH_DEPLOYMENT;
41+
let deployment = ESCROW_SUBGRAPH_DEPLOYMENT;
4242

4343
let handle = move |extensions: Extensions| async move {
4444
let received_deployment = extensions

crates/service/src/middleware/labels.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ mod tests {
105105
async fn test_label_middleware() {
106106
let middleware = from_fn(labels_middleware);
107107

108-
let deployment = *ESCROW_SUBGRAPH_DEPLOYMENT;
108+
let deployment = ESCROW_SUBGRAPH_DEPLOYMENT;
109109
let sender = Address::ZERO;
110110
let allocation = Address::ZERO;
111111

crates/service/src/middleware/tap_context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ mod tests {
9191
#[tokio::test]
9292
async fn test_context_middleware() {
9393
let middleware = from_fn(context_middleware);
94-
let deployment = *ESCROW_SUBGRAPH_DEPLOYMENT;
94+
let deployment = ESCROW_SUBGRAPH_DEPLOYMENT;
9595
let query_body = QueryBody {
9696
query: "hello".to_string(),
9797
variables: None,

0 commit comments

Comments
 (0)