Skip to content

Commit

Permalink
fix clippy errors
Browse files Browse the repository at this point in the history
  • Loading branch information
NeverHappened committed Oct 11, 2024
1 parent f01ca63 commit a097d93
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 13 deletions.
4 changes: 2 additions & 2 deletions contracts/ibc_transfer/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ fn execute_send(
}),
timeout_height: Some(neutron_std::types::ibc::core::client::v1::Height {
revision_number: 2,
revision_height: timeout_height.unwrap_or_else(|| DEFAULT_TIMEOUT_HEIGHT),
revision_height: timeout_height.unwrap_or(DEFAULT_TIMEOUT_HEIGHT),
}),
timeout_timestamp: 0,
memo: "".to_string(),
Expand All @@ -172,7 +172,7 @@ fn execute_send(
}),
timeout_height: Some(neutron_std::types::ibc::core::client::v1::Height {
revision_number: 2,
revision_height: timeout_height.unwrap_or_else(|| DEFAULT_TIMEOUT_HEIGHT),
revision_height: timeout_height.unwrap_or(DEFAULT_TIMEOUT_HEIGHT),
}),
timeout_timestamp: 0,
memo: "".to_string(),
Expand Down
3 changes: 1 addition & 2 deletions contracts/neutron_interchain_queries/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,7 @@ pub fn register_balances_query(
update_period: u64,
) -> NeutronResult<Response> {
let msg: CosmosMsg =
new_register_balances_query_msg(contract, connection_id, addr, denoms, update_period)?
.into();
new_register_balances_query_msg(contract, connection_id, addr, denoms, update_period)?;

Ok(Response::new().add_message(msg))
}
Expand Down
4 changes: 2 additions & 2 deletions packages/neutron-sdk/src/interchain_queries/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub fn check_query_type(actual: String, expected: QueryType) -> NeutronResult<()
let expected_str: String = expected.into();
if actual != expected_str {
return Err(NeutronError::InvalidQueryType {
query_type: actual.into(),
query_type: actual,
});
}
Ok(())
Expand Down Expand Up @@ -45,7 +45,7 @@ pub fn get_raw_interchain_query_result(
interchain_query_id: u64,
) -> NeutronResult<QueryResult> {
let querier = InterchainqueriesQuerier::new(&deps.querier);
let query_res = querier.query_result(interchain_query_id.into())?;
let query_res = querier.query_result(interchain_query_id)?;
let res = query_res
.result
.ok_or_else(|| StdError::generic_err("no result in registered query"))?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ pub fn get_update_time(commission: &Option<ValidatorCommission>) -> Option<u64>
}

/// Returns denom for total supply from StorageValue key
pub fn get_total_supply_denom(denom: &Vec<u8>) -> Option<String> {
pub fn get_total_supply_denom(denom: &[u8]) -> Option<String> {
if denom.len() < 2 {
return None;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -503,9 +503,7 @@ pub fn register_interchain_account(
connection_id,
interchain_account_id,
register_fee,
ordering: ordering
.unwrap_or_else(|| ChannelOrdering::OrderOrdered)
.into(),
ordering: ordering.unwrap_or(ChannelOrdering::OrderOrdered).into(),
}
.into())
}
6 changes: 3 additions & 3 deletions packages/neutron-sdk/src/interchain_queries/v045/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,11 @@ impl KVReconstruct for Balances {

for kv in storage_values {
let (_, denom) = deconstruct_account_denom_balance_key(kv.key.to_vec())?;
let amount = if kv.value.len() > 0 {
let amount = if kv.value.is_empty() {
0u128
} else {
let balance: CosmosCoin = CosmosCoin::decode(kv.value.as_slice())?;
Uint128::from_str(balance.amount.as_str())?.u128()
} else {
0u128
};

coins.push(Coin::new(amount, denom))
Expand Down

0 comments on commit a097d93

Please sign in to comment.