Skip to content

Commit

Permalink
convince clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
epanchee committed Feb 12, 2025
1 parent 6498212 commit 91554d2
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion contracts/pair_concentrated_duality/src/migrate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pub fn migrate(deps: DepsMut, _env: Env, msg: MigrateMsg) -> StdResult<Response>
StdError::generic_err(format!("This endpoint is allowed only for {CONTRACT_NAME}"))
);

Err(StdError::generic_err("Not yet implemented".to_string()).into())
Err(StdError::generic_err("Not yet implemented".to_string()))
}
}?;

Expand Down
4 changes: 2 additions & 2 deletions contracts/pair_concentrated_duality/src/orderbook/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ impl OrderbookState {
maker_coin_out,
}) => Ok([taker_coin_out, maker_coin_out]
.into_iter()
.filter_map(|coin| coin)
.flatten()
.collect_vec()),
})
})
Expand Down Expand Up @@ -266,7 +266,7 @@ impl OrderbookState {
.into_result()
.map_err(|err| StdError::generic_err(err.to_string()))?
.into_result()
.map_err(|err| StdError::generic_err(err))?;
.map_err(StdError::generic_err)?;

self.orders = from_json::<CustomQueryAllLimitOrderTrancheUserByAddressResponse>(
&response_raw,
Expand Down
4 changes: 3 additions & 1 deletion contracts/pair_concentrated_duality/src/orderbook/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,9 @@ fn price_to_duality_notation(
) -> Result<String, OverflowError> {
let prec_diff = quote_precision as i8 - base_precision as i8;
let price = match prec_diff.cmp(&0) {
Ordering::Less => price / Decimal256::from_integer(10u128.pow(prec_diff.abs() as u32)),
Ordering::Less => {
price / Decimal256::from_integer(10u128.pow(prec_diff.unsigned_abs() as u32))
}
Ordering::Equal => price,
Ordering::Greater => price * Decimal256::from_integer(10u128.pow(prec_diff as u32)),
}
Expand Down
4 changes: 2 additions & 2 deletions packages/astroport_test/src/modules/neutron_stargate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ impl Module for NeutronStargate {
self.orders
.borrow_mut()
.entry(sender.to_string())
.or_insert_with(HashMap::new)
.insert(tranche_key, value.try_into()?);
.or_default()
.insert(tranche_key, value);
Ok(AppResponse::default())
}
MsgCancelLimitOrder::TYPE_URL => {
Expand Down

0 comments on commit 91554d2

Please sign in to comment.