From fb6b4f541157e42edb721b9425f64e615cbb19dc Mon Sep 17 00:00:00 2001 From: Willem Wyndham Date: Mon, 11 Mar 2024 15:57:02 -0400 Subject: [PATCH] fix: clippy and fmt --- cmd/soroban-cli/src/commands/config/data.rs | 4 ++-- cmd/soroban-cli/src/commands/contract/deploy/asset.rs | 2 +- cmd/soroban-cli/src/commands/contract/deploy/wasm.rs | 2 +- cmd/soroban-cli/src/commands/contract/extend.rs | 2 +- cmd/soroban-cli/src/commands/contract/install.rs | 2 +- cmd/soroban-cli/src/commands/contract/invoke.rs | 4 ++-- cmd/soroban-cli/src/commands/contract/restore.rs | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cmd/soroban-cli/src/commands/config/data.rs b/cmd/soroban-cli/src/commands/config/data.rs index 9c5b4ec1f7..28afed8b8b 100644 --- a/cmd/soroban-cli/src/commands/config/data.rs +++ b/cmd/soroban-cli/src/commands/config/data.rs @@ -45,7 +45,7 @@ pub fn spec_dir() -> Result { Ok(dir) } -pub fn write(action: Action, rpc_url: Uri) -> Result { +pub fn write(action: Action, rpc_url: &Uri) -> Result { let data = Data { action, rpc_url: rpc_url.to_string(), @@ -151,7 +151,7 @@ mod test { let sim = SimulateTransactionResponse::default(); let original_action: Action = sim.into(); - let id = write(original_action.clone(), rpc_uri.clone()).unwrap(); + let id = write(original_action.clone(), &rpc_uri.clone()).unwrap(); let (action, new_rpc_uri) = read(&id).unwrap(); assert_eq!(rpc_uri, new_rpc_uri); match (action, original_action) { diff --git a/cmd/soroban-cli/src/commands/contract/deploy/asset.rs b/cmd/soroban-cli/src/commands/contract/deploy/asset.rs index 75f6559402..41e7367dce 100644 --- a/cmd/soroban-cli/src/commands/contract/deploy/asset.rs +++ b/cmd/soroban-cli/src/commands/contract/deploy/asset.rs @@ -115,7 +115,7 @@ impl NetworkRunnable for Cmd { .await? .try_into()?; if args.map_or(true, |a| !a.no_cache) { - data::write(get_txn_resp, network.rpc_uri()?)?; + data::write(get_txn_resp, &network.rpc_uri()?)?; } Ok(stellar_strkey::Contract(contract_id.0).to_string()) diff --git a/cmd/soroban-cli/src/commands/contract/deploy/wasm.rs b/cmd/soroban-cli/src/commands/contract/deploy/wasm.rs index 1bedfc730b..40369b2301 100644 --- a/cmd/soroban-cli/src/commands/contract/deploy/wasm.rs +++ b/cmd/soroban-cli/src/commands/contract/deploy/wasm.rs @@ -176,7 +176,7 @@ impl NetworkRunnable for Cmd { .await? .try_into()?; if global_args.map_or(true, |a| !a.no_cache) { - data::write(get_txn_resp, network.rpc_uri()?)?; + data::write(get_txn_resp, &network.rpc_uri()?)?; } Ok(stellar_strkey::Contract(contract_id.0).to_string()) } diff --git a/cmd/soroban-cli/src/commands/contract/extend.rs b/cmd/soroban-cli/src/commands/contract/extend.rs index 0c51a88d08..ab7834959b 100644 --- a/cmd/soroban-cli/src/commands/contract/extend.rs +++ b/cmd/soroban-cli/src/commands/contract/extend.rs @@ -166,7 +166,7 @@ impl NetworkRunnable for Cmd { .prepare_and_send_transaction(&tx, &key, &[], &network.network_passphrase, None, None) .await?; if args.map_or(true, |a| !a.no_cache) { - data::write(res.clone().try_into()?, network.rpc_uri()?)?; + data::write(res.clone().try_into()?, &network.rpc_uri()?)?; } let events = res.events()?; diff --git a/cmd/soroban-cli/src/commands/contract/install.rs b/cmd/soroban-cli/src/commands/contract/install.rs index ec9de88055..d4a0d541fc 100644 --- a/cmd/soroban-cli/src/commands/contract/install.rs +++ b/cmd/soroban-cli/src/commands/contract/install.rs @@ -139,7 +139,7 @@ impl NetworkRunnable for Cmd { .send_assembled_transaction(txn, &key, &[], &network.network_passphrase, None, None) .await?; if args.map_or(true, |a| !a.no_cache) { - data::write(txn_resp.clone().try_into().unwrap(), network.rpc_uri()?)?; + data::write(txn_resp.clone().try_into().unwrap(), &network.rpc_uri()?)?; } // Currently internal errors are not returned if the contract code is expired if let Some(TransactionResult { diff --git a/cmd/soroban-cli/src/commands/contract/invoke.rs b/cmd/soroban-cli/src/commands/contract/invoke.rs index d7a890334c..2e8414285c 100644 --- a/cmd/soroban-cli/src/commands/contract/invoke.rs +++ b/cmd/soroban-cli/src/commands/contract/invoke.rs @@ -368,7 +368,7 @@ impl NetworkRunnable for Cmd { let txn = self.fee.apply_to_assembled_txn(txn); let sim_res = txn.sim_response(); if global_args.map_or(true, |a| !a.no_cache) { - data::write(sim_res.clone().into(), network.rpc_uri()?)?; + data::write(sim_res.clone().into(), &network.rpc_uri()?)?; } let (return_value, events) = if self.is_view() { (sim_res.results()?[0].xdr.clone(), sim_res.events()?) @@ -390,7 +390,7 @@ impl NetworkRunnable for Cmd { ) .await?; if !no_cache { - data::write(res.clone().try_into()?, network.rpc_uri()?)?; + data::write(res.clone().try_into()?, &network.rpc_uri()?)?; } (res.return_value()?, res.contract_events()?) }; diff --git a/cmd/soroban-cli/src/commands/contract/restore.rs b/cmd/soroban-cli/src/commands/contract/restore.rs index a335d9860c..8b5921a1a6 100644 --- a/cmd/soroban-cli/src/commands/contract/restore.rs +++ b/cmd/soroban-cli/src/commands/contract/restore.rs @@ -167,7 +167,7 @@ impl NetworkRunnable for Cmd { .prepare_and_send_transaction(&tx, &key, &[], &network.network_passphrase, None, None) .await?; if args.map_or(true, |a| !a.no_cache) { - data::write(res.clone().try_into()?, network.rpc_uri()?)?; + data::write(res.clone().try_into()?, &network.rpc_uri()?)?; } let meta = res .result_meta