Skip to content

Commit 9a8c451

Browse files
committed
more clippy suggestions
1 parent 092eeb8 commit 9a8c451

File tree

23 files changed

+289
-247
lines changed

23 files changed

+289
-247
lines changed

crates/driver/src/boundary/liquidity/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ impl Fetcher {
201201
Liquidity::BalancerV3StableSurge(pool) => balancer::v3::stable_surge::to_domain(id, pool),
202202
Liquidity::LimitOrder(pool) => zeroex::to_domain(id, pool),
203203
Liquidity::Concentrated(pool) => uniswap::v3::to_domain(id, pool),
204-
Liquidity::Erc4626(order) => erc4626::to_domain(id, order),
204+
Liquidity::Erc4626(order) => erc4626::to_domain(id, *order),
205205
}
206206
// Ignore "bad" liquidity - this allows the driver to continue
207207
// solving with the other good stuff.

crates/driver/src/domain/liquidity/balancer/v3/gyro_2clp.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,12 @@ impl Reserves {
8585
}
8686

8787
/// Returns an iterator over the token reserves.
88-
pub fn iter(&self) -> impl Iterator<Item = &Reserve> + ExactSizeIterator + Clone + '_ {
88+
pub fn iter(&self) -> impl ExactSizeIterator<Item = &Reserve> + Clone + '_ {
8989
self.0.iter()
9090
}
9191

9292
/// Returns an iterator over the token reserves by value.
93-
pub fn iter_copied(&self) -> impl Iterator<Item = Reserve> + ExactSizeIterator + Clone + '_ {
93+
pub fn iter_copied(&self) -> impl ExactSizeIterator<Item = Reserve> + Clone + '_ {
9494
self.0.iter().copied()
9595
}
9696

crates/driver/src/infra/config/file/load.rs

Lines changed: 128 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -277,52 +277,63 @@ pub async fn load(chain: Chain, path: &Path) -> infra::Config {
277277
}
278278
.expect("no Balancer V2 preset for current network")
279279
},
280-
file::BalancerV2Config::Manual {
281-
vault,
282-
weighted,
283-
weighted_v3plus,
284-
stable,
285-
liquidity_bootstrapping,
286-
composable_stable,
287-
gyro_e,
288-
gyro_2clp,
289-
gyro_3clp,
290-
pool_deny_list,
291-
graph_url,
292-
reinit_interval,
293-
..
294-
} => liquidity::config::BalancerV2 {
295-
vault: vault.into(),
296-
weighted: weighted
297-
.into_iter()
298-
.map(eth::ContractAddress::from)
299-
.collect(),
300-
weighted_v3plus: weighted_v3plus
301-
.into_iter()
302-
.map(eth::ContractAddress::from)
303-
.collect(),
304-
stable: stable.into_iter().map(eth::ContractAddress::from).collect(),
305-
liquidity_bootstrapping: liquidity_bootstrapping
306-
.into_iter()
307-
.map(eth::ContractAddress::from)
308-
.collect(),
309-
composable_stable: composable_stable
310-
.into_iter()
311-
.map(eth::ContractAddress::from)
312-
.collect(),
313-
gyro_e: gyro_e.into_iter().map(eth::ContractAddress::from).collect(),
314-
gyro_2clp: gyro_2clp
315-
.into_iter()
316-
.map(eth::ContractAddress::from)
317-
.collect(),
318-
gyro_3clp: gyro_3clp
319-
.into_iter()
320-
.map(eth::ContractAddress::from)
321-
.collect(),
322-
pool_deny_list: pool_deny_list.clone(),
323-
graph_url,
324-
reinit_interval,
325-
},
280+
file::BalancerV2Config::Manual(manual_config) => {
281+
let manual_config = manual_config.as_ref();
282+
liquidity::config::BalancerV2 {
283+
vault: manual_config.vault.into(),
284+
weighted: manual_config
285+
.weighted
286+
.iter()
287+
.cloned()
288+
.map(eth::ContractAddress::from)
289+
.collect(),
290+
weighted_v3plus: manual_config
291+
.weighted_v3plus
292+
.iter()
293+
.cloned()
294+
.map(eth::ContractAddress::from)
295+
.collect(),
296+
stable: manual_config
297+
.stable
298+
.iter()
299+
.cloned()
300+
.map(eth::ContractAddress::from)
301+
.collect(),
302+
liquidity_bootstrapping: manual_config
303+
.liquidity_bootstrapping
304+
.iter()
305+
.cloned()
306+
.map(eth::ContractAddress::from)
307+
.collect(),
308+
composable_stable: manual_config
309+
.composable_stable
310+
.iter()
311+
.cloned()
312+
.map(eth::ContractAddress::from)
313+
.collect(),
314+
gyro_e: manual_config
315+
.gyro_e
316+
.iter()
317+
.cloned()
318+
.map(eth::ContractAddress::from)
319+
.collect(),
320+
gyro_2clp: manual_config
321+
.gyro_2clp
322+
.iter()
323+
.cloned()
324+
.map(eth::ContractAddress::from)
325+
.collect(),
326+
gyro_3clp: manual_config
327+
.gyro_3clp
328+
.iter()
329+
.cloned()
330+
.map(eth::ContractAddress::from)
331+
.collect(),
332+
pool_deny_list: manual_config.pool_deny_list.clone(),
333+
graph_url: manual_config.graph_url.clone(),
334+
reinit_interval: manual_config.reinit_interval,
335+
}
336+
}
326337
})
327338
.collect(),
328339
balancer_v3: config
@@ -347,59 +358,77 @@ pub async fn load(chain: Chain, path: &Path) -> infra::Config {
347358
}
348359
.expect("no Balancer V3 preset for current network")
349360
},
350-
file::BalancerV3Config::Manual {
351-
vault,
352-
batch_router,
353-
weighted,
354-
stable,
355-
stable_v2,
356-
stable_surge,
357-
stable_surge_v2,
358-
gyro_e,
359-
gyro_2clp,
360-
reclamm,
361-
quantamm,
362-
pool_deny_list,
363-
graph_url,
364-
reinit_interval,
365-
..
366-
} => liquidity::config::BalancerV3 {
367-
vault: vault.into(),
368-
batch_router: batch_router.into(),
369-
weighted: weighted
370-
.into_iter()
371-
.map(eth::ContractAddress::from)
372-
.collect(),
373-
stable: stable.into_iter().map(eth::ContractAddress::from).collect(),
374-
stable_v2: stable_v2
375-
.into_iter()
376-
.map(eth::ContractAddress::from)
377-
.collect(),
378-
stable_surge: stable_surge
379-
.into_iter()
380-
.map(eth::ContractAddress::from)
381-
.collect(),
382-
stable_surge_v2: stable_surge_v2
383-
.into_iter()
384-
.map(eth::ContractAddress::from)
385-
.collect(),
386-
gyro_e: gyro_e.into_iter().map(eth::ContractAddress::from).collect(),
387-
gyro_2clp: gyro_2clp
388-
.into_iter()
389-
.map(eth::ContractAddress::from)
390-
.collect(),
391-
reclamm: reclamm
392-
.into_iter()
393-
.map(eth::ContractAddress::from)
394-
.collect(),
395-
quantamm: quantamm
396-
.into_iter()
397-
.map(eth::ContractAddress::from)
398-
.collect(),
399-
pool_deny_list: pool_deny_list.clone(),
400-
graph_url,
401-
reinit_interval,
402-
},
361+
file::BalancerV3Config::Manual(manual_config) => {
362+
let file::ManualBalancerV3Config {
363+
vault,
364+
batch_router,
365+
weighted,
366+
stable,
367+
stable_v2,
368+
stable_surge,
369+
stable_surge_v2,
370+
gyro_e,
371+
gyro_2clp,
372+
reclamm,
373+
quantamm,
374+
pool_deny_list,
375+
graph_url,
376+
reinit_interval,
377+
} = manual_config.as_ref();
378+
379+
liquidity::config::BalancerV3 {
380+
vault: (*vault).into(),
381+
batch_router: (*batch_router).into(),
382+
weighted: weighted
383+
.iter()
384+
.cloned()
385+
.map(eth::ContractAddress::from)
386+
.collect(),
387+
stable: stable
388+
.iter()
389+
.cloned()
390+
.map(eth::ContractAddress::from)
391+
.collect(),
392+
stable_v2: stable_v2
393+
.iter()
394+
.cloned()
395+
.map(eth::ContractAddress::from)
396+
.collect(),
397+
stable_surge: stable_surge
398+
.iter()
399+
.cloned()
400+
.map(eth::ContractAddress::from)
401+
.collect(),
402+
stable_surge_v2: stable_surge_v2
403+
.iter()
404+
.cloned()
405+
.map(eth::ContractAddress::from)
406+
.collect(),
407+
gyro_e: gyro_e
408+
.iter()
409+
.cloned()
410+
.map(eth::ContractAddress::from)
411+
.collect(),
412+
gyro_2clp: gyro_2clp
413+
.iter()
414+
.cloned()
415+
.map(eth::ContractAddress::from)
416+
.collect(),
417+
reclamm: reclamm
418+
.iter()
419+
.cloned()
420+
.map(eth::ContractAddress::from)
421+
.collect(),
422+
quantamm: quantamm
423+
.iter()
424+
.cloned()
425+
.map(eth::ContractAddress::from)
426+
.collect(),
427+
pool_deny_list: pool_deny_list.clone(),
428+
graph_url: graph_url.clone(),
429+
reinit_interval: *reinit_interval,
430+
}
431+
}
403432
})
404433
.collect(),
405434
zeroex: config

0 commit comments

Comments
 (0)