Skip to content

Commit

Permalink
Reduce minor compilation warnings (#2058)
Browse files Browse the repository at this point in the history
# Description
Reduces Rust compilation warnings. Remaining warnings related to
generated smart contracts will be fixed in
cowprotocol/ethcontract-rs#964
  • Loading branch information
squadgazzz authored Nov 22, 2023
1 parent f7b1e2e commit e185f8e
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion crates/driver/src/infra/solver/dto/auction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ struct Token {
}

// TODO Remove dead_code
#[allow(dead_code)]
#[allow(dead_code, clippy::enum_variant_names)]
#[derive(Debug, Serialize)]
#[serde(tag = "kind", rename_all = "lowercase")]
enum Liquidity {
Expand Down
2 changes: 1 addition & 1 deletion crates/orderbook/src/database/orders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ impl LimitOrderCounting for Postgres {
let mut ex = self.pool.acquire().await?;
Ok(database::orders::count_limit_orders_by_owner(
&mut ex,
now_in_epoch_seconds().try_into().unwrap(),
now_in_epoch_seconds().into(),
&ByteArray(owner.0),
)
.await?
Expand Down
2 changes: 1 addition & 1 deletion crates/shared/src/price_estimation/trade_finder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ impl SettleOutput {
/// Computes the actual [`Trade::out_amount`] based on the simulation.
fn out_amount(&self, kind: OrderKind) -> Result<U256> {
let balances = &self.queried_balances;
let balance_before = balances.get(0).context("no balance before settlement")?;
let balance_before = balances.first().context("no balance before settlement")?;
let balance_after = balances.get(1).context("no balance after settlement")?;
let out_amount = match kind {
// for sell orders we track the buy_token amount which increases during the settlement
Expand Down
2 changes: 1 addition & 1 deletion crates/shared/src/sources/uniswap_v3/event_fetching.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub enum UniswapV3Event {
impl ParseLog for UniswapV3Event {
fn parse_log(log: RawLog) -> Result<Self, ExecutionError> {
let standard_event: Option<Result<UniswapV3Event, ExecutionError>> =
log.topics.get(0).copied().map(|topic| match topic {
log.topics.first().copied().map(|topic| match topic {
H256(BURN_TOPIC) => Ok(UniswapV3Event::Burn(
log.clone().decode(
UniswapV3Pool::raw_contract()
Expand Down
9 changes: 2 additions & 7 deletions crates/solver/src/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -540,13 +540,8 @@ impl Driver {
tracing::debug!(?hash, "settled transaction");
}

self.logger.report_on_batch(
&(winning_solver, winning_settlement),
rated_settlements
.into_iter()
.map(|(solver, settlement)| (solver, settlement))
.collect(),
);
self.logger
.report_on_batch(&(winning_solver, winning_settlement), rated_settlements);
}
// Happens after settlement submission so that we do not delay it.
self.logger.report_simulation_errors(
Expand Down
1 change: 1 addition & 0 deletions crates/solvers/src/api/routes/solve/dto/auction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ struct Token {
trusted: bool,
}

#[allow(clippy::enum_variant_names)]
#[derive(Debug, Deserialize)]
#[serde(tag = "kind", rename_all = "lowercase", deny_unknown_fields)]
enum Liquidity {
Expand Down

0 comments on commit e185f8e

Please sign in to comment.