From d43ba33e155bc55f5ea50d9efea778471c4a6341 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Fri, 21 May 2021 12:24:03 +1000 Subject: [PATCH] Lift out `Ok` wrapping from match expression --- swap/src/cli/command.rs | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/swap/src/cli/command.rs b/swap/src/cli/command.rs index 1da75a2e..3af1c944 100644 --- a/swap/src/cli/command.rs +++ b/swap/src/cli/command.rs @@ -47,7 +47,7 @@ where let is_testnet = args.testnet; let data = args.data; - match args.cmd { + let arguments = match args.cmd { RawCommand::BuyXmr { seller_peer_id, seller_addr: SellerAddr { seller_addr }, @@ -62,7 +62,7 @@ where monero_daemon_address, }, tor: Tor { tor_socks5_port }, - } => Ok(Arguments { + } => Arguments { env_config: env_config_from(is_testnet), debug, json, @@ -85,14 +85,14 @@ where ), tor_socks5_port, }, - }), - RawCommand::History => Ok(Arguments { + }, + RawCommand::History => Arguments { env_config: env_config_from(is_testnet), debug, json, data_dir: data::data_dir_from(data, is_testnet)?, cmd: Command::History, - }), + }, RawCommand::Resume { swap_id: SwapId { swap_id }, seller_addr: SellerAddr { seller_addr }, @@ -107,7 +107,7 @@ where monero_daemon_address, }, tor: Tor { tor_socks5_port }, - } => Ok(Arguments { + } => Arguments { env_config: env_config_from(is_testnet), debug, json, @@ -127,7 +127,7 @@ where ), tor_socks5_port, }, - }), + }, RawCommand::Cancel { swap_id: SwapId { swap_id }, force, @@ -136,7 +136,7 @@ where bitcoin_electrum_rpc_url, bitcoin_target_block, }, - } => Ok(Arguments { + } => Arguments { env_config: env_config_from(is_testnet), debug, json, @@ -150,7 +150,7 @@ where )?, bitcoin_target_block: bitcoin_target_block_from(bitcoin_target_block, is_testnet), }, - }), + }, RawCommand::Refund { swap_id: SwapId { swap_id }, force, @@ -159,7 +159,7 @@ where bitcoin_electrum_rpc_url, bitcoin_target_block, }, - } => Ok(Arguments { + } => Arguments { env_config: env_config_from(is_testnet), debug, json, @@ -173,8 +173,10 @@ where )?, bitcoin_target_block: bitcoin_target_block_from(bitcoin_target_block, is_testnet), }, - }), - } + }, + }; + + Ok(arguments) } #[derive(Debug, PartialEq)]