From ac79ae6848e15f75006c660b7fb5fe5a4ee25187 Mon Sep 17 00:00:00 2001 From: Kirill Fomichev Date: Mon, 27 Sep 2021 11:57:23 +0300 Subject: [PATCH] Rpc: use rust convenient methods --- client/src/rpc_client.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/src/rpc_client.rs b/client/src/rpc_client.rs index cad2e475cb..42f269988e 100644 --- a/client/src/rpc_client.rs +++ b/client/src/rpc_client.rs @@ -2993,7 +2993,7 @@ impl RpcClient { } = serde_json::from_value::>>>(response)?; let accounts: Vec> = accounts .into_iter() - .map(|rpc_account| rpc_account.map(|a| a.decode()).flatten()) + .map(|rpc_account| rpc_account.and_then(|a| a.decode())) .collect(); Ok(Response { context, @@ -4025,7 +4025,7 @@ fn parse_keyed_accounts( accounts: Vec, request: RpcRequest, ) -> ClientResult> { - let mut pubkey_accounts: Vec<(Pubkey, Account)> = Vec::new(); + let mut pubkey_accounts: Vec<(Pubkey, Account)> = Vec::with_capacity(accounts.len()); for RpcKeyedAccount { pubkey, account } in accounts.into_iter() { let pubkey = pubkey.parse().map_err(|_| { ClientError::new_with_request(