Skip to content

Commit

Permalink
feat: avoid excess calls to clone()
Browse files Browse the repository at this point in the history
  • Loading branch information
foxpy committed Nov 25, 2024
1 parent 2f4d929 commit 4e62195
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions contracts/factory/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,8 @@ fn query_state(deps: Deps<NeutronQuery>) -> ContractResult<Binary> {
let state = STATE.range(deps.storage, None, None, cosmwasm_std::Order::Ascending);
let out = state
.collect::<StdResult<Vec<_>>>()?
.iter()
.map(|(k, v): &(String, cosmwasm_std::Addr)| (k.clone(), v.to_string()))
.into_iter()
.map(|(k, v)| (k, v.into_string()))
.collect::<HashMap<String, String>>();
Ok(to_json_binary(&out)?)
}
Expand All @@ -494,7 +494,7 @@ fn query_locate(deps: Deps<NeutronQuery>, items: Vec<String>) -> ContractResult<

for item in items {
let addr = STATE.load(deps.storage, &item)?;
contracts.insert(item.clone(), addr.to_string());
contracts.insert(item, addr.into_string());
}
Ok(to_json_binary(&contracts)?)
}
Expand Down

0 comments on commit 4e62195

Please sign in to comment.