diff --git a/contracts/crypto-verify/src/contract.rs b/contracts/crypto-verify/src/contract.rs index e2601d47d4..41fe879201 100644 --- a/contracts/crypto-verify/src/contract.rs +++ b/contracts/crypto-verify/src/contract.rs @@ -274,7 +274,7 @@ mod tests { }; let raw = query(deps.as_ref(), mock_env(), verify_msg).unwrap(); - let res: VerifyResponse = from_json(&raw).unwrap(); + let res: VerifyResponse = from_json(raw).unwrap(); assert_eq!(res, VerifyResponse { verifies: true }); } @@ -296,7 +296,7 @@ mod tests { }; let raw = query(deps.as_ref(), mock_env(), verify_msg).unwrap(); - let res: VerifyResponse = from_json(&raw).unwrap(); + let res: VerifyResponse = from_json(raw).unwrap(); assert_eq!(res, VerifyResponse { verifies: false }); } @@ -339,7 +339,7 @@ mod tests { signer_address: signer_address.into(), }; let raw = query(deps.as_ref(), mock_env(), verify_msg).unwrap(); - let res: VerifyResponse = from_json(&raw).unwrap(); + let res: VerifyResponse = from_json(raw).unwrap(); assert_eq!(res, VerifyResponse { verifies: true }); } @@ -360,7 +360,7 @@ mod tests { }; let raw = query(deps.as_ref(), mock_env(), verify_msg).unwrap(); - let res: VerifyResponse = from_json(&raw).unwrap(); + let res: VerifyResponse = from_json(raw).unwrap(); assert_eq!(res, VerifyResponse { verifies: false }); } @@ -380,7 +380,7 @@ mod tests { signer_address: signer_address.into(), }; let raw = query(deps.as_ref(), mock_env(), verify_msg).unwrap(); - let res: VerifyResponse = from_json(&raw).unwrap(); + let res: VerifyResponse = from_json(raw).unwrap(); assert_eq!(res, VerifyResponse { verifies: false }); // Broken signature @@ -447,7 +447,7 @@ mod tests { v, }; let raw = query(deps.as_ref(), mock_env(), msg).unwrap(); - let res: VerifyResponse = from_json(&raw).unwrap(); + let res: VerifyResponse = from_json(raw).unwrap(); assert_eq!(res, VerifyResponse { verifies: true }); } @@ -475,7 +475,7 @@ mod tests { }; let raw = query(deps.as_ref(), mock_env(), verify_msg).unwrap(); - let res: VerifyResponse = from_json(&raw).unwrap(); + let res: VerifyResponse = from_json(raw).unwrap(); assert_eq!(res, VerifyResponse { verifies: true }); } @@ -508,7 +508,7 @@ mod tests { }; let raw = query(deps.as_ref(), mock_env(), verify_msg).unwrap(); - let res: VerifyResponse = from_json(&raw).unwrap(); + let res: VerifyResponse = from_json(raw).unwrap(); assert_eq!(res, VerifyResponse { verifies: true }); } @@ -542,7 +542,7 @@ mod tests { }; let raw = query(deps.as_ref(), mock_env(), verify_msg).unwrap(); - let res: VerifyResponse = from_json(&raw).unwrap(); + let res: VerifyResponse = from_json(raw).unwrap(); assert_eq!(res, VerifyResponse { verifies: true }); } @@ -573,7 +573,7 @@ mod tests { }; let raw = query(deps.as_ref(), mock_env(), verify_msg).unwrap(); - let res: VerifyResponse = from_json(&raw).unwrap(); + let res: VerifyResponse = from_json(raw).unwrap(); assert_eq!(res, VerifyResponse { verifies: false }); } @@ -626,7 +626,7 @@ mod tests { }; let raw = query(deps.as_ref(), mock_env(), verify_msg).unwrap(); - let res: VerifyResponse = from_json(&raw).unwrap(); + let res: VerifyResponse = from_json(raw).unwrap(); assert_eq!(res, VerifyResponse { verifies: true }); } @@ -648,7 +648,7 @@ mod tests { }; let raw = query(deps.as_ref(), mock_env(), verify_msg).unwrap(); - let res: VerifyResponse = from_json(&raw).unwrap(); + let res: VerifyResponse = from_json(raw).unwrap(); assert_eq!(res, VerifyResponse { verifies: false }); } @@ -683,7 +683,7 @@ mod tests { let query_msg = QueryMsg::ListVerificationSchemes {}; let raw = query(deps.as_ref(), mock_env(), query_msg).unwrap(); - let res: ListVerificationsResponse = from_json(&raw).unwrap(); + let res: ListVerificationsResponse = from_json(raw).unwrap(); assert_eq!( res, diff --git a/contracts/cyberpunk/src/contract.rs b/contracts/cyberpunk/src/contract.rs index 4e2106aa7c..2084f630df 100644 --- a/contracts/cyberpunk/src/contract.rs +++ b/contracts/cyberpunk/src/contract.rs @@ -274,12 +274,12 @@ mod tests { ); let symbols: Vec = - from_json(&query(deps.as_ref(), mock_env(), QueryMsg::Denoms {}).unwrap()).unwrap(); + from_json(query(deps.as_ref(), mock_env(), QueryMsg::Denoms {}).unwrap()).unwrap(); assert_eq!(symbols.len(), 98); let denom: DenomMetadata = from_json( - &query( + query( deps.as_ref(), mock_env(), QueryMsg::Denom { diff --git a/contracts/cyberpunk/tests/integration.rs b/contracts/cyberpunk/tests/integration.rs index 0140b40cf6..539a53eb2a 100644 --- a/contracts/cyberpunk/tests/integration.rs +++ b/contracts/cyberpunk/tests/integration.rs @@ -152,13 +152,13 @@ fn test_env() { ) .unwrap(); - let received_env: Env = from_json(&res.data.unwrap()).unwrap(); + let received_env: Env = from_json(res.data.unwrap()).unwrap(); assert_eq!(received_env, env); let env = mock_env(); let received_env: Env = - from_json(&query(&mut deps, env.clone(), QueryMsg::MirrorEnv {}).unwrap()).unwrap(); + from_json(query(&mut deps, env.clone(), QueryMsg::MirrorEnv {}).unwrap()).unwrap(); assert_eq!(received_env, env); } diff --git a/contracts/floaty/src/contract.rs b/contracts/floaty/src/contract.rs index 15b824bf25..157dcf5765 100644 --- a/contracts/floaty/src/contract.rs +++ b/contracts/floaty/src/contract.rs @@ -40,7 +40,7 @@ pub fn execute( .storage .get(CONFIG_KEY) .ok_or_else(|| StdError::not_found("State"))?; - let state: State = from_json(&data)?; + let state: State = from_json(data)?; if info.sender == state.verifier { let to_addr = state.beneficiary; @@ -77,7 +77,7 @@ fn query_verifier(deps: Deps) -> StdResult { .storage .get(CONFIG_KEY) .ok_or_else(|| StdError::not_found("State"))?; - let state: State = from_json(&data)?; + let state: State = from_json(data)?; Ok(VerifierResponse { verifier: state.verifier.into(), }) @@ -124,7 +124,7 @@ mod tests { // it worked, let's check the state let data = deps.storage.get(CONFIG_KEY).expect("no data stored"); - let state: State = from_json(&data).unwrap(); + let state: State = from_json(data).unwrap(); assert_eq!(state, expected_state); } @@ -246,7 +246,7 @@ mod tests { // state should not change let data = deps.storage.get(CONFIG_KEY).expect("no data stored"); - let state: State = from_json(&data).unwrap(); + let state: State = from_json(data).unwrap(); assert_eq!( state, State { diff --git a/contracts/hackatom/src/contract.rs b/contracts/hackatom/src/contract.rs index 463ebbab90..f62ffcb319 100644 --- a/contracts/hackatom/src/contract.rs +++ b/contracts/hackatom/src/contract.rs @@ -41,7 +41,7 @@ pub fn migrate(deps: DepsMut, _env: Env, msg: MigrateMsg) -> Result Result StdResult { .storage .get(CONFIG_KEY) .ok_or_else(|| StdError::not_found("State"))?; - let state: State = from_json(&data)?; + let state: State = from_json(data)?; Ok(VerifierResponse { verifier: state.verifier.into(), }) @@ -336,7 +336,7 @@ mod tests { // it worked, let's check the state let data = deps.storage.get(CONFIG_KEY).expect("no data stored"); - let state: State = from_json(&data).unwrap(); + let state: State = from_json(data).unwrap(); assert_eq!(state, expected_state); } @@ -514,7 +514,7 @@ mod tests { // state should not change let data = deps.storage.get(CONFIG_KEY).expect("no data stored"); - let state: State = from_json(&data).unwrap(); + let state: State = from_json(data).unwrap(); assert_eq!( state, State { diff --git a/contracts/hackatom/tests/integration.rs b/contracts/hackatom/tests/integration.rs index 68920da908..890309ffd6 100644 --- a/contracts/hackatom/tests/integration.rs +++ b/contracts/hackatom/tests/integration.rs @@ -183,7 +183,7 @@ fn querier_callbacks_work() { // querying with balance gets the balance let query_msg = QueryMsg::OtherBalance { address: rich_addr }; let query_response = query(&mut deps, mock_env(), query_msg).unwrap(); - let bal: AllBalanceResponse = from_json(&query_response).unwrap(); + let bal: AllBalanceResponse = from_json(query_response).unwrap(); assert_eq!(bal.amount, rich_balance); // querying other accounts gets none @@ -191,7 +191,7 @@ fn querier_callbacks_work() { address: String::from("someone else"), }; let query_response = query(&mut deps, mock_env(), query_msg).unwrap(); - let bal: AllBalanceResponse = from_json(&query_response).unwrap(); + let bal: AllBalanceResponse = from_json(query_response).unwrap(); assert_eq!(bal.amount, vec![]); } diff --git a/contracts/ibc-reflect-send/src/ibc.rs b/contracts/ibc-reflect-send/src/ibc.rs index 8086e103c2..6faabd5c10 100644 --- a/contracts/ibc-reflect-send/src/ibc.rs +++ b/contracts/ibc-reflect-send/src/ibc.rs @@ -108,18 +108,18 @@ pub fn ibc_packet_ack( // which local channel was this packet send from let caller = msg.original_packet.src.channel_id; // we need to parse the ack based on our request - let packet: PacketMsg = from_json(&msg.original_packet.data)?; + let packet: PacketMsg = from_json(msg.original_packet.data)?; match packet { PacketMsg::Dispatch { .. } => { - let res: AcknowledgementMsg = from_json(&msg.acknowledgement.data)?; + let res: AcknowledgementMsg = from_json(msg.acknowledgement.data)?; acknowledge_dispatch(deps, caller, res) } PacketMsg::WhoAmI {} => { - let res: AcknowledgementMsg = from_json(&msg.acknowledgement.data)?; + let res: AcknowledgementMsg = from_json(msg.acknowledgement.data)?; acknowledge_who_am_i(deps, caller, res) } PacketMsg::Balances {} => { - let res: AcknowledgementMsg = from_json(&msg.acknowledgement.data)?; + let res: AcknowledgementMsg = from_json(msg.acknowledgement.data)?; acknowledge_balances(deps, env, caller, res) } } @@ -305,7 +305,7 @@ mod tests { channel_id: channel_id.into(), }; let r = query(deps.as_ref(), mock_env(), q).unwrap(); - let acct: AccountResponse = from_json(&r).unwrap(); + let acct: AccountResponse = from_json(r).unwrap(); assert!(acct.remote_addr.is_none()); assert!(acct.remote_balance.is_empty()); assert_eq!(0, acct.last_update_time.nanos()); @@ -319,7 +319,7 @@ mod tests { channel_id: channel_id.into(), }; let r = query(deps.as_ref(), mock_env(), q).unwrap(); - let acct: AccountResponse = from_json(&r).unwrap(); + let acct: AccountResponse = from_json(r).unwrap(); assert_eq!(acct.remote_addr.unwrap(), remote_addr); assert!(acct.remote_balance.is_empty()); assert_eq!(0, acct.last_update_time.nanos()); diff --git a/contracts/ibc-reflect-send/src/state.rs b/contracts/ibc-reflect-send/src/state.rs index e9c024b0ae..44f78f4e08 100644 --- a/contracts/ibc-reflect-send/src/state.rs +++ b/contracts/ibc-reflect-send/src/state.rs @@ -33,7 +33,7 @@ pub struct AccountData { pub fn may_load_account(storage: &dyn Storage, id: &str) -> StdResult> { storage .get(&namespace_with_key(&[PREFIX_ACCOUNTS], id.as_bytes())) - .map(|v| from_json(&v)) + .map(from_json) .transpose() } @@ -63,7 +63,7 @@ pub fn range_accounts( .map(|(key, val)| { Ok(( String::from_utf8(key[PREFIX_ACCOUNTS.len() + 2..].to_vec())?, - from_json(&val)?, + from_json(val)?, )) }) } @@ -72,7 +72,7 @@ pub fn load_config(storage: &dyn Storage) -> StdResult { storage .get(&to_length_prefixed(KEY_CONFIG)) .ok_or_else(|| StdError::not_found("config")) - .and_then(|v| from_json(&v)) + .and_then(from_json) } pub fn save_config(storage: &mut dyn Storage, item: &Config) -> StdResult<()> { diff --git a/contracts/ibc-reflect/src/contract.rs b/contracts/ibc-reflect/src/contract.rs index e3b59f10d3..7d8efb44c2 100644 --- a/contracts/ibc-reflect/src/contract.rs +++ b/contracts/ibc-reflect/src/contract.rs @@ -241,7 +241,7 @@ pub fn ibc_packet_receive( let packet = msg.packet; // which local channel did this packet come on let caller = packet.dest.channel_id; - let msg: PacketMsg = from_json(&packet.data)?; + let msg: PacketMsg = from_json(packet.data)?; match msg { PacketMsg::Dispatch { msgs } => receive_dispatch(deps, caller, msgs), PacketMsg::WhoAmI {} => receive_who_am_i(deps, caller), @@ -482,7 +482,7 @@ mod tests { // no accounts set yet let raw = query(deps.as_ref(), mock_env(), QueryMsg::ListAccounts {}).unwrap(); - let res: ListAccountsResponse = from_json(&raw).unwrap(); + let res: ListAccountsResponse = from_json(raw).unwrap(); assert_eq!(0, res.accounts.len()); // fake a reply and ensure this works @@ -497,7 +497,7 @@ mod tests { // ensure this is now registered let raw = query(deps.as_ref(), mock_env(), QueryMsg::ListAccounts {}).unwrap(); - let res: ListAccountsResponse = from_json(&raw).unwrap(); + let res: ListAccountsResponse = from_json(raw).unwrap(); assert_eq!(1, res.accounts.len()); assert_eq!( &res.accounts[0], @@ -516,7 +516,7 @@ mod tests { }, ) .unwrap(); - let res: AccountResponse = from_json(&raw).unwrap(); + let res: AccountResponse = from_json(raw).unwrap(); assert_eq!(res.account.unwrap(), REFLECT_ADDR); } @@ -546,7 +546,7 @@ mod tests { res.events[0] ); // acknowledgement is an error - let ack: AcknowledgementMsg = from_json(&res.acknowledgement).unwrap(); + let ack: AcknowledgementMsg = from_json(res.acknowledgement).unwrap(); assert_eq!( ack.unwrap_err(), "invalid packet: account channel-123 not found" @@ -560,7 +560,7 @@ mod tests { let res = ibc_packet_receive(deps.as_mut(), mock_env(), msg).unwrap(); // assert app-level success - let ack: AcknowledgementMsg<()> = from_json(&res.acknowledgement).unwrap(); + let ack: AcknowledgementMsg<()> = from_json(res.acknowledgement).unwrap(); ack.unwrap(); // and we dispatch the BankMsg via submessage @@ -597,7 +597,7 @@ mod tests { // we didn't dispatch anything assert_eq!(0, res.messages.len()); // acknowledgement is an error - let ack: AcknowledgementMsg = from_json(&res.acknowledgement).unwrap(); + let ack: AcknowledgementMsg = from_json(res.acknowledgement).unwrap(); assert_eq!(ack.unwrap_err(), "invalid packet: Error parsing into type ibc_reflect::msg::PacketMsg: unknown variant `reflect_code_id`, expected one of `dispatch`, `who_am_i`, `balances`, `panic`, `return_err`, `return_msgs`"); } @@ -616,7 +616,7 @@ mod tests { // channel should be listed and have balance let raw = query(deps.as_ref(), mock_env(), QueryMsg::ListAccounts {}).unwrap(); - let res: ListAccountsResponse = from_json(&raw).unwrap(); + let res: ListAccountsResponse = from_json(raw).unwrap(); assert_eq!(1, res.accounts.len()); let balance = deps.as_ref().querier.query_all_balances(account).unwrap(); assert_eq!(funds, balance); @@ -652,7 +652,7 @@ mod tests { // and removes the account lookup let raw = query(deps.as_ref(), mock_env(), QueryMsg::ListAccounts {}).unwrap(); - let res: ListAccountsResponse = from_json(&raw).unwrap(); + let res: ListAccountsResponse = from_json(raw).unwrap(); assert_eq!(0, res.accounts.len()); } } diff --git a/contracts/ibc-reflect/src/state.rs b/contracts/ibc-reflect/src/state.rs index 3321731f5a..112f0227d6 100644 --- a/contracts/ibc-reflect/src/state.rs +++ b/contracts/ibc-reflect/src/state.rs @@ -22,7 +22,7 @@ pub struct Config { pub fn may_load_account(storage: &dyn Storage, id: &str) -> StdResult> { storage .get(&namespace_with_key(&[PREFIX_ACCOUNTS], id.as_bytes())) - .map(|v| from_json(&v)) + .map(from_json) .transpose() } @@ -52,7 +52,7 @@ pub fn range_accounts( .map(|(key, val)| { Ok(( String::from_utf8(key[PREFIX_ACCOUNTS.len() + 2..].to_vec())?, - from_json(&val)?, + from_json(val)?, )) }) } @@ -61,7 +61,7 @@ pub fn load_item(storage: &dyn Storage, key: &[u8]) -> StdR storage .get(&to_length_prefixed(key)) .ok_or_else(|| StdError::not_found(type_name::())) - .and_then(|v| from_json(&v)) + .and_then(from_json) } pub fn save_item(storage: &mut dyn Storage, key: &[u8], item: &T) -> StdResult<()> { diff --git a/contracts/queue/src/contract.rs b/contracts/queue/src/contract.rs index 1e1334154c..536921a4e4 100644 --- a/contracts/queue/src/contract.rs +++ b/contracts/queue/src/contract.rs @@ -112,7 +112,7 @@ fn query_sum(deps: Deps) -> StdResult { let values: StdResult> = deps .storage .range_values(None, None, Order::Ascending) - .map(|v| from_json(&v)) + .map(from_json) .collect(); let sum = values?.iter().fold(0, |s, v| s + v.value); Ok(SumResponse { sum }) @@ -340,7 +340,7 @@ mod tests { let query_msg = QueryMsg::List {}; let ids: ListResponse = - from_json(&query(deps.as_ref(), mock_env(), query_msg).unwrap()).unwrap(); + from_json(query(deps.as_ref(), mock_env(), query_msg).unwrap()).unwrap(); assert_eq!(ids.empty, Vec::::new()); assert_eq!(ids.early, vec![0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f]); assert_eq!(ids.late, vec![0x20, 0x21, 0x22, 0x23, 0x24]); diff --git a/contracts/queue/tests/integration.rs b/contracts/queue/tests/integration.rs index 66b0117480..b0a86ae1d5 100644 --- a/contracts/queue/tests/integration.rs +++ b/contracts/queue/tests/integration.rs @@ -48,13 +48,13 @@ fn create_contract() -> (Instance, MessageInf fn get_count(deps: &mut Instance) -> u32 { let data = query(deps, mock_env(), QueryMsg::Count {}).unwrap(); - let res: CountResponse = from_json(&data).unwrap(); + let res: CountResponse = from_json(data).unwrap(); res.count } fn get_sum(deps: &mut Instance) -> i32 { let data = query(deps, mock_env(), QueryMsg::Sum {}).unwrap(); - let res: SumResponse = from_json(&data).unwrap(); + let res: SumResponse = from_json(data).unwrap(); res.sum } @@ -128,7 +128,7 @@ fn push_and_pop() { // ensure we popped properly assert!(res.data.is_some()); let data = res.data.unwrap(); - let item: Item = from_json(&data).unwrap(); + let item: Item = from_json(data).unwrap(); assert_eq!(item.value, 25); assert_eq!(get_count(&mut deps), 1); @@ -223,7 +223,7 @@ fn query_list() { // since we count up to 0x20 in early, we get early and late both with data let query_msg = QueryMsg::List {}; - let ids: ListResponse = from_json(&query(&mut deps, mock_env(), query_msg).unwrap()).unwrap(); + let ids: ListResponse = from_json(query(&mut deps, mock_env(), query_msg).unwrap()).unwrap(); assert_eq!(ids.empty, Vec::::new()); assert_eq!(ids.early, vec![0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f]); assert_eq!(ids.late, vec![0x20, 0x21, 0x22, 0x23, 0x24]); diff --git a/contracts/reflect/src/contract.rs b/contracts/reflect/src/contract.rs index f4b848d8d4..fbe9076ec7 100644 --- a/contracts/reflect/src/contract.rs +++ b/contracts/reflect/src/contract.rs @@ -365,7 +365,7 @@ mod tests { text: "demo one".to_string(), }; let response = query(deps.as_ref(), mock_env(), msg).unwrap(); - let value: CapitalizedResponse = from_json(&response).unwrap(); + let value: CapitalizedResponse = from_json(response).unwrap(); assert_eq!(value.text, "DEMO ONE"); } @@ -381,8 +381,8 @@ mod tests { .into(), }; let response = query(deps.as_ref(), mock_env(), msg).unwrap(); - let outer: ChainResponse = from_json(&response).unwrap(); - let inner: AllBalanceResponse = from_json(&outer.data).unwrap(); + let outer: ChainResponse = from_json(response).unwrap(); + let inner: AllBalanceResponse = from_json(outer.data).unwrap(); assert_eq!(inner.amount, coins(123, "ucosm")); // with custom query @@ -390,8 +390,8 @@ mod tests { request: SpecialQuery::Ping {}.into(), }; let response = query(deps.as_ref(), mock_env(), msg).unwrap(); - let outer: ChainResponse = from_json(&response).unwrap(); - let inner: SpecialResponse = from_json(&outer.data).unwrap(); + let outer: ChainResponse = from_json(response).unwrap(); + let inner: SpecialResponse = from_json(outer.data).unwrap(); assert_eq!(inner.msg, "pong"); } @@ -452,7 +452,7 @@ mod tests { // query for the real id let raw = query(deps.as_ref(), mock_env(), QueryMsg::SubMsgResult { id }).unwrap(); - let qres: Reply = from_json(&raw).unwrap(); + let qres: Reply = from_json(raw).unwrap(); assert_eq!(qres.id, id); let result = qres.result.unwrap(); assert_eq!(result.data, Some(data)); diff --git a/contracts/reflect/src/state.rs b/contracts/reflect/src/state.rs index 7afa6ac455..2fc752b225 100644 --- a/contracts/reflect/src/state.rs +++ b/contracts/reflect/src/state.rs @@ -19,7 +19,7 @@ pub fn load_reply(storage: &dyn Storage, id: u64) -> StdResult { storage .get(&namespace_with_key(&[RESULT_PREFIX], &id.to_be_bytes())) .ok_or_else(|| StdError::not_found(format!("reply {id}"))) - .and_then(|v| from_json(&v)) + .and_then(from_json) } pub fn save_reply(storage: &mut dyn Storage, id: u64, reply: &Reply) -> StdResult<()> { @@ -38,7 +38,7 @@ pub fn load_config(storage: &dyn Storage) -> StdResult { storage .get(&to_length_prefixed(CONFIG_KEY)) .ok_or_else(|| StdError::not_found("config")) - .and_then(|v| from_json(&v)) + .and_then(from_json) } pub fn save_config(storage: &mut dyn Storage, item: &State) -> StdResult<()> { diff --git a/contracts/reflect/src/testing.rs b/contracts/reflect/src/testing.rs index b67a6a680c..f46dac69ed 100644 --- a/contracts/reflect/src/testing.rs +++ b/contracts/reflect/src/testing.rs @@ -37,7 +37,7 @@ mod tests { #[test] fn custom_query_execute_ping() { let res = custom_query_execute(&SpecialQuery::Ping {}).unwrap(); - let response: SpecialResponse = from_json(&res).unwrap(); + let response: SpecialResponse = from_json(res).unwrap(); assert_eq!(response.msg, "pong"); } @@ -47,7 +47,7 @@ mod tests { text: "fOObaR".to_string(), }) .unwrap(); - let response: SpecialResponse = from_json(&res).unwrap(); + let response: SpecialResponse = from_json(res).unwrap(); assert_eq!(response.msg, "FOOBAR"); } diff --git a/contracts/reflect/tests/integration.rs b/contracts/reflect/tests/integration.rs index 6ab20d5aa5..1333ad53bb 100644 --- a/contracts/reflect/tests/integration.rs +++ b/contracts/reflect/tests/integration.rs @@ -83,7 +83,7 @@ fn proper_initialization() { // it worked, let's query the state let res = query(&mut deps, mock_env(), QueryMsg::Owner {}).unwrap(); - let value: OwnerResponse = from_json(&res).unwrap(); + let value: OwnerResponse = from_json(res).unwrap(); assert_eq!("creator", value.owner.as_str()); } @@ -159,7 +159,7 @@ fn transfer() { // should change state assert_eq!(0, res.messages.len()); let res = query(&mut deps, mock_env(), QueryMsg::Owner {}).unwrap(); - let value: OwnerResponse = from_json(&res).unwrap(); + let value: OwnerResponse = from_json(res).unwrap(); assert_eq!("friend", value.owner.as_str()); } @@ -203,8 +203,8 @@ fn supply_query() { ) .unwrap(); - let res: ChainResponse = from_json(&res).unwrap(); - let res: SupplyResponse = from_json(&res.data).unwrap(); + let res: ChainResponse = from_json(res).unwrap(); + let res: SupplyResponse = from_json(res.data).unwrap(); assert_eq!(res.amount, coin(25, "OSMO")); } @@ -225,7 +225,7 @@ fn dispatch_custom_query() { }, ) .unwrap(); - let value: CapitalizedResponse = from_json(&res).unwrap(); + let value: CapitalizedResponse = from_json(res).unwrap(); assert_eq!(value.text, "DEMO ONE"); } @@ -282,7 +282,7 @@ fn reply_and_query() { // query for the real id let raw = query(&mut deps, mock_env(), QueryMsg::SubMsgResult { id }).unwrap(); - let qres: Reply = from_json(&raw).unwrap(); + let qres: Reply = from_json(raw).unwrap(); assert_eq!(qres.id, id); let result = qres.result.unwrap(); assert_eq!(result.data, Some(data)); diff --git a/contracts/staking/src/state.rs b/contracts/staking/src/state.rs index 759ccfc145..6af6670213 100644 --- a/contracts/staking/src/state.rs +++ b/contracts/staking/src/state.rs @@ -23,7 +23,7 @@ pub fn may_load_map( ) -> StdResult> { storage .get(&namespace_with_key(&[prefix], key)) - .map(|v| from_json(&v)) + .map(from_json) .transpose() } @@ -85,7 +85,7 @@ pub fn load_item(storage: &dyn Storage, key: &[u8]) -> StdR storage .get(&to_length_prefixed(key)) .ok_or_else(|| StdError::not_found(type_name::())) - .and_then(|v| from_json(&v)) + .and_then(from_json) } pub fn save_item(storage: &mut dyn Storage, key: &[u8], item: &T) -> StdResult<()> { diff --git a/contracts/staking/tests/integration.rs b/contracts/staking/tests/integration.rs index 3b68b55a2e..cca65a9db4 100644 --- a/contracts/staking/tests/integration.rs +++ b/contracts/staking/tests/integration.rs @@ -106,7 +106,7 @@ fn proper_initialization() { // token info is proper let res = query(&mut deps, mock_env(), QueryMsg::TokenInfo {}).unwrap(); - let token: TokenInfoResponse = from_json(&res).unwrap(); + let token: TokenInfoResponse = from_json(res).unwrap(); assert_eq!(&token.name, &msg.name); assert_eq!(&token.symbol, &msg.symbol); assert_eq!(token.decimals, msg.decimals); @@ -120,7 +120,7 @@ fn proper_initialization() { }, ) .unwrap(); - let bal: BalanceResponse = from_json(&res).unwrap(); + let bal: BalanceResponse = from_json(res).unwrap(); assert_eq!(bal.balance, Uint128::new(0)); // no claims @@ -132,12 +132,12 @@ fn proper_initialization() { }, ) .unwrap(); - let claim: ClaimsResponse = from_json(&res).unwrap(); + let claim: ClaimsResponse = from_json(res).unwrap(); assert_eq!(claim.claims, Uint128::new(0)); // investment info correct let res = query(&mut deps, mock_env(), QueryMsg::Investment {}).unwrap(); - let invest: InvestmentResponse = from_json(&res).unwrap(); + let invest: InvestmentResponse = from_json(res).unwrap(); assert_eq!(&invest.owner, &creator); assert_eq!(&invest.validator, &msg.validator); assert_eq!(invest.exit_tax, msg.exit_tax); diff --git a/packages/std/src/binary.rs b/packages/std/src/binary.rs index 7030ee02aa..bb65eea8db 100644 --- a/packages/std/src/binary.rs +++ b/packages/std/src/binary.rs @@ -451,7 +451,7 @@ mod tests { let binary = Binary(vec![0u8, 187, 61, 11, 250, 0]); let json = to_json_vec(&binary).unwrap(); - let deserialized: Binary = from_json(&json).unwrap(); + let deserialized: Binary = from_json(json).unwrap(); assert_eq!(binary, deserialized); } @@ -463,7 +463,7 @@ mod tests { let expected = vec![0u8, 187, 61, 11, 250, 0]; let serialized = to_json_vec(&b64_str).unwrap(); - let deserialized: Binary = from_json(&serialized).unwrap(); + let deserialized: Binary = from_json(serialized).unwrap(); assert_eq!(expected, deserialized.as_slice()); } diff --git a/packages/std/src/exports.rs b/packages/std/src/exports.rs index ad33a91814..c745bc82e7 100644 --- a/packages/std/src/exports.rs +++ b/packages/std/src/exports.rs @@ -415,9 +415,9 @@ where let info: Vec = unsafe { consume_region(info_ptr) }; let msg: Vec = unsafe { consume_region(msg_ptr) }; - let env: Env = try_into_contract_result!(from_json(&env)); - let info: MessageInfo = try_into_contract_result!(from_json(&info)); - let msg: M = try_into_contract_result!(from_json(&msg)); + let env: Env = try_into_contract_result!(from_json(env)); + let info: MessageInfo = try_into_contract_result!(from_json(info)); + let msg: M = try_into_contract_result!(from_json(msg)); let mut deps = make_dependencies(); instantiate_fn(deps.as_mut(), env, info, msg).into() @@ -439,9 +439,9 @@ where let info: Vec = unsafe { consume_region(info_ptr) }; let msg: Vec = unsafe { consume_region(msg_ptr) }; - let env: Env = try_into_contract_result!(from_json(&env)); - let info: MessageInfo = try_into_contract_result!(from_json(&info)); - let msg: M = try_into_contract_result!(from_json(&msg)); + let env: Env = try_into_contract_result!(from_json(env)); + let info: MessageInfo = try_into_contract_result!(from_json(info)); + let msg: M = try_into_contract_result!(from_json(msg)); let mut deps = make_dependencies(); execute_fn(deps.as_mut(), env, info, msg).into() @@ -461,8 +461,8 @@ where let env: Vec = unsafe { consume_region(env_ptr) }; let msg: Vec = unsafe { consume_region(msg_ptr) }; - let env: Env = try_into_contract_result!(from_json(&env)); - let msg: M = try_into_contract_result!(from_json(&msg)); + let env: Env = try_into_contract_result!(from_json(env)); + let msg: M = try_into_contract_result!(from_json(msg)); let mut deps = make_dependencies(); migrate_fn(deps.as_mut(), env, msg).into() @@ -482,8 +482,8 @@ where let env: Vec = unsafe { consume_region(env_ptr) }; let msg: Vec = unsafe { consume_region(msg_ptr) }; - let env: Env = try_into_contract_result!(from_json(&env)); - let msg: M = try_into_contract_result!(from_json(&msg)); + let env: Env = try_into_contract_result!(from_json(env)); + let msg: M = try_into_contract_result!(from_json(msg)); let mut deps = make_dependencies(); sudo_fn(deps.as_mut(), env, msg).into() @@ -502,8 +502,8 @@ where let env: Vec = unsafe { consume_region(env_ptr) }; let msg: Vec = unsafe { consume_region(msg_ptr) }; - let env: Env = try_into_contract_result!(from_json(&env)); - let msg: Reply = try_into_contract_result!(from_json(&msg)); + let env: Env = try_into_contract_result!(from_json(env)); + let msg: Reply = try_into_contract_result!(from_json(msg)); let mut deps = make_dependencies(); reply_fn(deps.as_mut(), env, msg).into() @@ -522,8 +522,8 @@ where let env: Vec = unsafe { consume_region(env_ptr) }; let msg: Vec = unsafe { consume_region(msg_ptr) }; - let env: Env = try_into_contract_result!(from_json(&env)); - let msg: M = try_into_contract_result!(from_json(&msg)); + let env: Env = try_into_contract_result!(from_json(env)); + let msg: M = try_into_contract_result!(from_json(msg)); let deps = make_dependencies(); query_fn(deps.as_ref(), env, msg).into() @@ -542,8 +542,8 @@ where let env: Vec = unsafe { consume_region(env_ptr) }; let msg: Vec = unsafe { consume_region(msg_ptr) }; - let env: Env = try_into_contract_result!(from_json(&env)); - let msg: IbcChannelOpenMsg = try_into_contract_result!(from_json(&msg)); + let env: Env = try_into_contract_result!(from_json(env)); + let msg: IbcChannelOpenMsg = try_into_contract_result!(from_json(msg)); let mut deps = make_dependencies(); contract_fn(deps.as_mut(), env, msg).into() @@ -563,8 +563,8 @@ where let env: Vec = unsafe { consume_region(env_ptr) }; let msg: Vec = unsafe { consume_region(msg_ptr) }; - let env: Env = try_into_contract_result!(from_json(&env)); - let msg: IbcChannelConnectMsg = try_into_contract_result!(from_json(&msg)); + let env: Env = try_into_contract_result!(from_json(env)); + let msg: IbcChannelConnectMsg = try_into_contract_result!(from_json(msg)); let mut deps = make_dependencies(); contract_fn(deps.as_mut(), env, msg).into() @@ -584,8 +584,8 @@ where let env: Vec = unsafe { consume_region(env_ptr) }; let msg: Vec = unsafe { consume_region(msg_ptr) }; - let env: Env = try_into_contract_result!(from_json(&env)); - let msg: IbcChannelCloseMsg = try_into_contract_result!(from_json(&msg)); + let env: Env = try_into_contract_result!(from_json(env)); + let msg: IbcChannelCloseMsg = try_into_contract_result!(from_json(msg)); let mut deps = make_dependencies(); contract_fn(deps.as_mut(), env, msg).into() @@ -605,8 +605,8 @@ where let env: Vec = unsafe { consume_region(env_ptr) }; let msg: Vec = unsafe { consume_region(msg_ptr) }; - let env: Env = try_into_contract_result!(from_json(&env)); - let msg: IbcPacketReceiveMsg = try_into_contract_result!(from_json(&msg)); + let env: Env = try_into_contract_result!(from_json(env)); + let msg: IbcPacketReceiveMsg = try_into_contract_result!(from_json(msg)); let mut deps = make_dependencies(); contract_fn(deps.as_mut(), env, msg).into() @@ -626,8 +626,8 @@ where let env: Vec = unsafe { consume_region(env_ptr) }; let msg: Vec = unsafe { consume_region(msg_ptr) }; - let env: Env = try_into_contract_result!(from_json(&env)); - let msg: IbcPacketAckMsg = try_into_contract_result!(from_json(&msg)); + let env: Env = try_into_contract_result!(from_json(env)); + let msg: IbcPacketAckMsg = try_into_contract_result!(from_json(msg)); let mut deps = make_dependencies(); contract_fn(deps.as_mut(), env, msg).into() @@ -647,8 +647,8 @@ where let env: Vec = unsafe { consume_region(env_ptr) }; let msg: Vec = unsafe { consume_region(msg_ptr) }; - let env: Env = try_into_contract_result!(from_json(&env)); - let msg: IbcPacketTimeoutMsg = try_into_contract_result!(from_json(&msg)); + let env: Env = try_into_contract_result!(from_json(env)); + let msg: IbcPacketTimeoutMsg = try_into_contract_result!(from_json(msg)); let mut deps = make_dependencies(); contract_fn(deps.as_mut(), env, msg).into() diff --git a/packages/std/src/hex_binary.rs b/packages/std/src/hex_binary.rs index 223fae6a4c..aeb30b4c48 100644 --- a/packages/std/src/hex_binary.rs +++ b/packages/std/src/hex_binary.rs @@ -516,7 +516,7 @@ mod tests { let binary = HexBinary(vec![0u8, 187, 61, 11, 250, 0]); let json = to_json_vec(&binary).unwrap(); - let deserialized: HexBinary = from_json(&json).unwrap(); + let deserialized: HexBinary = from_json(json).unwrap(); assert_eq!(binary, deserialized); } @@ -528,7 +528,7 @@ mod tests { let expected = vec![0u8, 187, 61, 11, 250, 0]; let serialized = to_json_vec(&hex).unwrap(); - let deserialized: HexBinary = from_json(&serialized).unwrap(); + let deserialized: HexBinary = from_json(serialized).unwrap(); assert_eq!(expected, deserialized.as_slice()); } diff --git a/packages/std/src/math/int128.rs b/packages/std/src/math/int128.rs index a0e28019c1..bc5cd241fc 100644 --- a/packages/std/src/math/int128.rs +++ b/packages/std/src/math/int128.rs @@ -824,7 +824,7 @@ mod tests { let orig = Int128::from(1234567890987654321i128); let serialized = to_json_vec(&orig).unwrap(); assert_eq!(serialized.as_slice(), b"\"1234567890987654321\""); - let parsed: Int128 = from_json(&serialized).unwrap(); + let parsed: Int128 = from_json(serialized).unwrap(); assert_eq!(parsed, orig); } diff --git a/packages/std/src/math/int256.rs b/packages/std/src/math/int256.rs index 77f9878722..70d17417d7 100644 --- a/packages/std/src/math/int256.rs +++ b/packages/std/src/math/int256.rs @@ -931,7 +931,7 @@ mod tests { let orig = Int256::from(1234567890987654321u128); let serialized = to_json_vec(&orig).unwrap(); assert_eq!(serialized.as_slice(), b"\"1234567890987654321\""); - let parsed: Int256 = from_json(&serialized).unwrap(); + let parsed: Int256 = from_json(serialized).unwrap(); assert_eq!(parsed, orig); } diff --git a/packages/std/src/math/int512.rs b/packages/std/src/math/int512.rs index ceb7829b5a..86b4a93b3a 100644 --- a/packages/std/src/math/int512.rs +++ b/packages/std/src/math/int512.rs @@ -959,7 +959,7 @@ mod tests { let orig = Int512::from(1234567890987654321u128); let serialized = to_json_vec(&orig).unwrap(); assert_eq!(serialized.as_slice(), b"\"1234567890987654321\""); - let parsed: Int512 = from_json(&serialized).unwrap(); + let parsed: Int512 = from_json(serialized).unwrap(); assert_eq!(parsed, orig); } diff --git a/packages/std/src/math/int64.rs b/packages/std/src/math/int64.rs index 2763d68a59..86a9bc4778 100644 --- a/packages/std/src/math/int64.rs +++ b/packages/std/src/math/int64.rs @@ -796,7 +796,7 @@ mod tests { let orig = Int64::from(1234567890987654321i64); let serialized = to_json_vec(&orig).unwrap(); assert_eq!(serialized.as_slice(), b"\"1234567890987654321\""); - let parsed: Int64 = from_json(&serialized).unwrap(); + let parsed: Int64 = from_json(serialized).unwrap(); assert_eq!(parsed, orig); } diff --git a/packages/std/src/math/uint128.rs b/packages/std/src/math/uint128.rs index 93e47ab95a..28081a9473 100644 --- a/packages/std/src/math/uint128.rs +++ b/packages/std/src/math/uint128.rs @@ -791,7 +791,7 @@ mod tests { let orig = Uint128(1234567890987654321); let serialized = to_json_vec(&orig).unwrap(); assert_eq!(serialized.as_slice(), b"\"1234567890987654321\""); - let parsed: Uint128 = from_json(&serialized).unwrap(); + let parsed: Uint128 = from_json(serialized).unwrap(); assert_eq!(parsed, orig); } diff --git a/packages/std/src/math/uint256.rs b/packages/std/src/math/uint256.rs index f12e327e33..a4a672ad80 100644 --- a/packages/std/src/math/uint256.rs +++ b/packages/std/src/math/uint256.rs @@ -1308,7 +1308,7 @@ mod tests { let orig = Uint256::from(1234567890987654321u128); let serialized = to_json_vec(&orig).unwrap(); assert_eq!(serialized.as_slice(), b"\"1234567890987654321\""); - let parsed: Uint256 = from_json(&serialized).unwrap(); + let parsed: Uint256 = from_json(serialized).unwrap(); assert_eq!(parsed, orig); } diff --git a/packages/std/src/math/uint512.rs b/packages/std/src/math/uint512.rs index 18583d1f4e..30be022a62 100644 --- a/packages/std/src/math/uint512.rs +++ b/packages/std/src/math/uint512.rs @@ -1014,7 +1014,7 @@ mod tests { let orig = Uint512::from(1234567890987654321u128); let serialized = to_json_vec(&orig).unwrap(); assert_eq!(serialized.as_slice(), b"\"1234567890987654321\""); - let parsed: Uint512 = from_json(&serialized).unwrap(); + let parsed: Uint512 = from_json(serialized).unwrap(); assert_eq!(parsed, orig); } diff --git a/packages/std/src/math/uint64.rs b/packages/std/src/math/uint64.rs index b047c3e6a4..f168f893c2 100644 --- a/packages/std/src/math/uint64.rs +++ b/packages/std/src/math/uint64.rs @@ -712,7 +712,7 @@ mod tests { let orig = Uint64(1234567890987654321); let serialized = to_json_vec(&orig).unwrap(); assert_eq!(serialized.as_slice(), b"\"1234567890987654321\""); - let parsed: Uint64 = from_json(&serialized).unwrap(); + let parsed: Uint64 = from_json(serialized).unwrap(); assert_eq!(parsed, orig); } diff --git a/packages/std/src/results/response.rs b/packages/std/src/results/response.rs index 300066b8a5..a728675f40 100644 --- a/packages/std/src/results/response.rs +++ b/packages/std/src/results/response.rs @@ -309,7 +309,7 @@ mod tests { data: Some(Binary::from([0xAA, 0xBB])), }; let serialized = to_json_vec(&original).expect("encode contract result"); - let deserialized: Response = from_json(&serialized).expect("decode contract result"); + let deserialized: Response = from_json(serialized).expect("decode contract result"); assert_eq!(deserialized, original); } diff --git a/packages/std/src/serde.rs b/packages/std/src/serde.rs index 23793698b6..78a7b7d08f 100644 --- a/packages/std/src/serde.rs +++ b/packages/std/src/serde.rs @@ -136,7 +136,7 @@ mod tests { let msg = SomeMsg::Refund {}; let serialized: Binary = to_json_binary(&msg).unwrap(); - let parse_binary: SomeMsg = from_json(&serialized).unwrap(); + let parse_binary: SomeMsg = from_json(serialized).unwrap(); assert_eq!(parse_binary, msg); let parse_slice: SomeMsg = from_json(serialized.as_slice()).unwrap(); diff --git a/packages/std/src/testing/mock.rs b/packages/std/src/testing/mock.rs index 3aea470caa..d2ca6d65f6 100644 --- a/packages/std/src/testing/mock.rs +++ b/packages/std/src/testing/mock.rs @@ -1442,7 +1442,7 @@ mod tests { }) .unwrap() .unwrap(); - let res: SupplyResponse = from_json(&elf).unwrap(); + let res: SupplyResponse = from_json(elf).unwrap(); assert_eq!(res.amount, coin(444, "ELF")); let fly = bank @@ -1451,7 +1451,7 @@ mod tests { }) .unwrap() .unwrap(); - let res: SupplyResponse = from_json(&fly).unwrap(); + let res: SupplyResponse = from_json(fly).unwrap(); assert_eq!(res.amount, coin(777, "FLY")); // if a denom does not exist, should return zero amount, instead of throwing an error @@ -1461,7 +1461,7 @@ mod tests { }) .unwrap() .unwrap(); - let res: SupplyResponse = from_json(&atom).unwrap(); + let res: SupplyResponse = from_json(atom).unwrap(); assert_eq!(res.amount, coin(0, "ATOM")); } @@ -1475,7 +1475,7 @@ mod tests { .query(&BankQuery::AllBalances { address: addr }) .unwrap() .unwrap(); - let res: AllBalanceResponse = from_json(&all).unwrap(); + let res: AllBalanceResponse = from_json(all).unwrap(); assert_eq!(&res.amount, &balance); } @@ -1493,7 +1493,7 @@ mod tests { }) .unwrap() .unwrap(); - let res: BalanceResponse = from_json(&fly).unwrap(); + let res: BalanceResponse = from_json(fly).unwrap(); assert_eq!(res.amount, coin(777, "FLY")); // missing denom @@ -1504,7 +1504,7 @@ mod tests { }) .unwrap() .unwrap(); - let res: BalanceResponse = from_json(&miss).unwrap(); + let res: BalanceResponse = from_json(miss).unwrap(); assert_eq!(res.amount, coin(0, "MISS")); } @@ -1521,7 +1521,7 @@ mod tests { }) .unwrap() .unwrap(); - let res: AllBalanceResponse = from_json(&all).unwrap(); + let res: AllBalanceResponse = from_json(all).unwrap(); assert_eq!(res.amount, vec![]); // any denom on balances on empty account is empty coin @@ -1532,7 +1532,7 @@ mod tests { }) .unwrap() .unwrap(); - let res: BalanceResponse = from_json(&miss).unwrap(); + let res: BalanceResponse = from_json(miss).unwrap(); assert_eq!(res.amount, coin(0, "ELF")); } @@ -1570,7 +1570,7 @@ mod tests { }) .unwrap() .unwrap(); - let res: AllDenomMetadataResponse = from_json(&res).unwrap(); + let res: AllDenomMetadataResponse = from_json(res).unwrap(); assert_eq!(res.metadata.len(), 10); assert!(res.next_key.is_some()); @@ -1585,7 +1585,7 @@ mod tests { }) .unwrap() .unwrap(); - let res2: AllDenomMetadataResponse = from_json(&res2).unwrap(); + let res2: AllDenomMetadataResponse = from_json(res2).unwrap(); assert_eq!(res2.metadata.len(), 10); assert_ne!(res.metadata.last(), res2.metadata.first()); // should have no overlap @@ -1604,7 +1604,7 @@ mod tests { }) .unwrap() .unwrap(); - let res: AllDenomMetadataResponse = from_json(&res).unwrap(); + let res: AllDenomMetadataResponse = from_json(res).unwrap(); assert_eq!(res.metadata.len(), 100); assert!(res.next_key.is_none(), "no more data should be available"); assert_eq!(res.metadata[0].symbol, "FOO99", "should have been reversed"); @@ -1619,7 +1619,7 @@ mod tests { }) .unwrap() .unwrap(); - let more_res: AllDenomMetadataResponse = from_json(&more_res).unwrap(); + let more_res: AllDenomMetadataResponse = from_json(more_res).unwrap(); assert_eq!( more_res.metadata, res.metadata, "should be same as previous query" @@ -1637,7 +1637,7 @@ mod tests { }; let res = distribution.query(&query).unwrap().unwrap(); - let res: DelegatorWithdrawAddressResponse = from_json(&res).unwrap(); + let res: DelegatorWithdrawAddressResponse = from_json(res).unwrap(); assert_eq!(res.withdraw_address, "withdraw0"); let query = DistributionQuery::DelegatorWithdrawAddress { @@ -1645,7 +1645,7 @@ mod tests { }; let res = distribution.query(&query).unwrap().unwrap(); - let res: DelegatorWithdrawAddressResponse = from_json(&res).unwrap(); + let res: DelegatorWithdrawAddressResponse = from_json(res).unwrap(); assert_eq!(res.withdraw_address, "addr1"); } @@ -1660,7 +1660,7 @@ mod tests { }; let res = distribution.query(&query).unwrap().unwrap(); - let res: DelegatorValidatorsResponse = from_json(&res).unwrap(); + let res: DelegatorValidatorsResponse = from_json(res).unwrap(); assert_eq!(res.validators, ["valoper1", "valoper2"]); let query = DistributionQuery::DelegatorValidators { @@ -1668,7 +1668,7 @@ mod tests { }; let res = distribution.query(&query).unwrap().unwrap(); - let res: DelegatorValidatorsResponse = from_json(&res).unwrap(); + let res: DelegatorValidatorsResponse = from_json(res).unwrap(); assert_eq!(res.validators, ([] as [String; 0])); } @@ -1690,7 +1690,7 @@ mod tests { validator_address: "valoper0".to_string(), }; let res = distribution.query(&query).unwrap().unwrap(); - let res: DelegationRewardsResponse = from_json(&res).unwrap(); + let res: DelegationRewardsResponse = from_json(res).unwrap(); assert_eq!(res.rewards, valoper0_rewards); // delegator does not exist @@ -1699,7 +1699,7 @@ mod tests { validator_address: "valoper0".to_string(), }; let res = distribution.query(&query).unwrap().unwrap(); - let res: DelegationRewardsResponse = from_json(&res).unwrap(); + let res: DelegationRewardsResponse = from_json(res).unwrap(); assert_eq!(res.rewards.len(), 0); // validator does not exist @@ -1708,7 +1708,7 @@ mod tests { validator_address: "valopernonexistent".to_string(), }; let res = distribution.query(&query).unwrap().unwrap(); - let res: DelegationRewardsResponse = from_json(&res).unwrap(); + let res: DelegationRewardsResponse = from_json(res).unwrap(); assert_eq!(res.rewards.len(), 0); // add one more validator @@ -1720,7 +1720,7 @@ mod tests { delegator_address: "addr0".to_string(), }; let res = distribution.query(&query).unwrap().unwrap(); - let res: DelegationTotalRewardsResponse = from_json(&res).unwrap(); + let res: DelegationTotalRewardsResponse = from_json(res).unwrap(); assert_eq!( res.rewards, vec![ @@ -1761,7 +1761,7 @@ mod tests { port_id: Some("my_port".to_string()), }; let raw = ibc.query(query).unwrap().unwrap(); - let chan: ChannelResponse = from_json(&raw).unwrap(); + let chan: ChannelResponse = from_json(raw).unwrap(); assert_eq!(chan.channel, Some(chan1)); } @@ -1791,7 +1791,7 @@ mod tests { port_id: Some("myport".to_string()), }; let raw = ibc.query(query).unwrap().unwrap(); - let chan: ChannelResponse = from_json(&raw).unwrap(); + let chan: ChannelResponse = from_json(raw).unwrap(); assert_eq!(chan.channel, Some(chan1)); } @@ -1809,7 +1809,7 @@ mod tests { port_id: None, }; let raw = ibc.query(query).unwrap().unwrap(); - let chan: ChannelResponse = from_json(&raw).unwrap(); + let chan: ChannelResponse = from_json(raw).unwrap(); assert_eq!(chan.channel, None); } @@ -1826,7 +1826,7 @@ mod tests { port_id: Some("my_port".to_string()), }; let raw = ibc.query(query).unwrap().unwrap(); - let res: ListChannelsResponse = from_json(&raw).unwrap(); + let res: ListChannelsResponse = from_json(raw).unwrap(); assert_eq!(res.channels, vec![chan1, chan2]); } @@ -1841,7 +1841,7 @@ mod tests { // query channels matching "myport" (should be none) let query = &IbcQuery::ListChannels { port_id: None }; let raw = ibc.query(query).unwrap().unwrap(); - let res: ListChannelsResponse = from_json(&raw).unwrap(); + let res: ListChannelsResponse = from_json(raw).unwrap(); assert_eq!(res.channels, vec![]); } @@ -1855,7 +1855,7 @@ mod tests { // query channels matching "myport" (should be none) let query = &IbcQuery::PortId {}; let raw = ibc.query(query).unwrap().unwrap(); - let res: PortIdResponse = from_json(&raw).unwrap(); + let res: PortIdResponse = from_json(raw).unwrap(); assert_eq!(res.port_id, "myport"); } @@ -1882,7 +1882,7 @@ mod tests { .query(&StakingQuery::AllValidators {}) .unwrap() .unwrap(); - let vals: AllValidatorsResponse = from_json(&raw).unwrap(); + let vals: AllValidatorsResponse = from_json(raw).unwrap(); assert_eq!(vals.validators, vec![val1, val2]); } @@ -1913,7 +1913,7 @@ mod tests { .query(&StakingQuery::Validator { address: address1 }) .unwrap() .unwrap(); - let res: ValidatorResponse = from_json(&raw).unwrap(); + let res: ValidatorResponse = from_json(raw).unwrap(); assert_eq!(res.validator, Some(val1)); // query 2 @@ -1921,7 +1921,7 @@ mod tests { .query(&StakingQuery::Validator { address: address2 }) .unwrap() .unwrap(); - let res: ValidatorResponse = from_json(&raw).unwrap(); + let res: ValidatorResponse = from_json(raw).unwrap(); assert_eq!(res.validator, Some(val2)); // query non-existent @@ -1931,7 +1931,7 @@ mod tests { }) .unwrap() .unwrap(); - let res: ValidatorResponse = from_json(&raw).unwrap(); + let res: ValidatorResponse = from_json(raw).unwrap(); assert_eq!(res.validator, None); } @@ -1947,7 +1947,7 @@ mod tests { }) .unwrap() .unwrap(); - let dels: AllDelegationsResponse = from_json(&raw).unwrap(); + let dels: AllDelegationsResponse = from_json(raw).unwrap(); dels.delegations } @@ -1965,7 +1965,7 @@ mod tests { }) .unwrap() .unwrap(); - let dels: DelegationResponse = from_json(&raw).unwrap(); + let dels: DelegationResponse = from_json(raw).unwrap(); dels.delegation } diff --git a/packages/std/src/traits.rs b/packages/std/src/traits.rs index 56beac2c86..de44b1bd87 100644 --- a/packages/std/src/traits.rs +++ b/packages/std/src/traits.rs @@ -250,7 +250,7 @@ impl<'a, C: CustomQuery> QuerierWrapper<'a, C> { SystemResult::Ok(ContractResult::Err(contract_err)) => Err(StdError::generic_err( format!("Querier contract error: {contract_err}"), )), - SystemResult::Ok(ContractResult::Ok(value)) => from_json(&value), + SystemResult::Ok(ContractResult::Ok(value)) => from_json(value), } } @@ -536,7 +536,7 @@ mod tests { .raw_query(&to_json_vec(&query).unwrap()) .unwrap() .unwrap(); - let balance: BalanceResponse = from_json(&raw).unwrap(); + let balance: BalanceResponse = from_json(raw).unwrap(); assert_eq!(balance.amount.amount, Uint128::new(5)); } diff --git a/packages/vm/src/environment.rs b/packages/vm/src/environment.rs index 5463f11bf1..5dfd268166 100644 --- a/packages/vm/src/environment.rs +++ b/packages/vm/src/environment.rs @@ -899,7 +899,7 @@ mod tests { .unwrap() .unwrap() .unwrap(); - let balance: AllBalanceResponse = from_json(&res).unwrap(); + let balance: AllBalanceResponse = from_json(res).unwrap(); assert_eq!(balance.amount, coins(INIT_AMOUNT, INIT_DENOM)); } diff --git a/packages/vm/src/imports.rs b/packages/vm/src/imports.rs index 0ae804f939..b2c24a7ba1 100644 --- a/packages/vm/src/imports.rs +++ b/packages/vm/src/imports.rs @@ -1933,10 +1933,10 @@ mod tests { let response_ptr = do_query_chain(fe_mut.as_mut(), request_ptr).unwrap(); let response = force_read(&mut fe_mut, response_ptr); - let query_result: cosmwasm_std::QuerierResult = cosmwasm_std::from_json(&response).unwrap(); + let query_result: cosmwasm_std::QuerierResult = cosmwasm_std::from_json(response).unwrap(); let query_result_inner = query_result.unwrap(); let query_result_inner_inner = query_result_inner.unwrap(); - let parsed_again: AllBalanceResponse = from_json(&query_result_inner_inner).unwrap(); + let parsed_again: AllBalanceResponse = from_json(query_result_inner_inner).unwrap(); assert_eq!(parsed_again.amount, coins(INIT_AMOUNT, INIT_DENOM)); } @@ -1954,7 +1954,7 @@ mod tests { let response_ptr = do_query_chain(fe_mut.as_mut(), request_ptr).unwrap(); let response = force_read(&mut fe_mut, response_ptr); - let query_result: cosmwasm_std::QuerierResult = cosmwasm_std::from_json(&response).unwrap(); + let query_result: cosmwasm_std::QuerierResult = cosmwasm_std::from_json(response).unwrap(); match query_result { SystemResult::Ok(_) => panic!("This must not succeed"), SystemResult::Err(SystemError::InvalidRequest { request: err, .. }) => { @@ -1982,7 +1982,7 @@ mod tests { let response_ptr = do_query_chain(fe_mut.as_mut(), request_ptr).unwrap(); let response = force_read(&mut fe_mut, response_ptr); - let query_result: cosmwasm_std::QuerierResult = cosmwasm_std::from_json(&response).unwrap(); + let query_result: cosmwasm_std::QuerierResult = cosmwasm_std::from_json(response).unwrap(); match query_result { SystemResult::Ok(_) => panic!("This must not succeed"), SystemResult::Err(SystemError::NoSuchContract { addr }) => { diff --git a/packages/vm/src/instance.rs b/packages/vm/src/instance.rs index 677180ab17..c4be57cdbc 100644 --- a/packages/vm/src/instance.rs +++ b/packages/vm/src/instance.rs @@ -970,7 +970,7 @@ mod tests { .unwrap() .unwrap() .unwrap(); - let BalanceResponse { amount } = from_json(&response).unwrap(); + let BalanceResponse { amount } = from_json(response).unwrap(); assert_eq!(amount.amount.u128(), 8000); assert_eq!(amount.denom, "silver"); Ok(()) @@ -991,7 +991,7 @@ mod tests { .unwrap() .unwrap() .unwrap(); - let AllBalanceResponse { amount } = from_json(&response).unwrap(); + let AllBalanceResponse { amount } = from_json(response).unwrap(); assert_eq!(amount.len(), 2); assert_eq!(amount[0].amount.u128(), 10000); assert_eq!(amount[0].denom, "gold"); @@ -1026,7 +1026,7 @@ mod tests { .unwrap() .unwrap() .unwrap(); - let BalanceResponse { amount } = from_json(&response).unwrap(); + let BalanceResponse { amount } = from_json(response).unwrap(); assert_eq!(amount.amount.u128(), 500); Ok(()) }) @@ -1055,7 +1055,7 @@ mod tests { .unwrap() .unwrap() .unwrap(); - let BalanceResponse { amount } = from_json(&response).unwrap(); + let BalanceResponse { amount } = from_json(response).unwrap(); assert_eq!(amount.amount.u128(), 8000); Ok(()) }) diff --git a/packages/vm/src/testing/querier.rs b/packages/vm/src/testing/querier.rs index e5933637dd..cf516bceca 100644 --- a/packages/vm/src/testing/querier.rs +++ b/packages/vm/src/testing/querier.rs @@ -147,7 +147,7 @@ mod tests { .unwrap() .unwrap() .unwrap(); - let res: AllBalanceResponse = from_json(&all).unwrap(); + let res: AllBalanceResponse = from_json(all).unwrap(); assert_eq!(&res.amount, &balance); } @@ -171,7 +171,7 @@ mod tests { .unwrap() .unwrap() .unwrap(); - let res: BalanceResponse = from_json(&fly).unwrap(); + let res: BalanceResponse = from_json(fly).unwrap(); assert_eq!(res.amount, coin(777, "FLY")); // missing denom @@ -188,7 +188,7 @@ mod tests { .unwrap() .unwrap() .unwrap(); - let res: BalanceResponse = from_json(&miss).unwrap(); + let res: BalanceResponse = from_json(miss).unwrap(); assert_eq!(res.amount, coin(0, "MISS")); } @@ -211,7 +211,7 @@ mod tests { .unwrap() .unwrap() .unwrap(); - let res: AllBalanceResponse = from_json(&all).unwrap(); + let res: AllBalanceResponse = from_json(all).unwrap(); assert_eq!(res.amount, vec![]); // any denom on balances on empty account is empty coin @@ -228,7 +228,7 @@ mod tests { .unwrap() .unwrap() .unwrap(); - let res: BalanceResponse = from_json(&miss).unwrap(); + let res: BalanceResponse = from_json(miss).unwrap(); assert_eq!(res.amount, coin(0, "ELF")); } }