From f4f7b83d1fbddd31de8dd1720163a9a40d98ca3d Mon Sep 17 00:00:00 2001 From: Nikolay Volf Date: Wed, 15 Feb 2017 21:03:36 +0300 Subject: [PATCH] replace expect with an error (#4542) --- ethstore/src/ethstore.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ethstore/src/ethstore.rs b/ethstore/src/ethstore.rs index 0747ee157..8439d852b 100644 --- a/ethstore/src/ethstore.rs +++ b/ethstore/src/ethstore.rs @@ -271,7 +271,9 @@ impl SimpleSecretStore for EthMultiStore { // Remove from cache let mut cache = self.cache.write(); let is_empty = { - let mut accounts = cache.get_mut(address).expect("Entry exists, because it was returned by `get`; qed"); + let mut accounts = cache.get_mut(address) + .ok_or(Error::InvalidAccount)?; + if let Some(position) = accounts.iter().position(|acc| acc == &account) { accounts.remove(position); }