diff --git a/substrate/core/rpc/src/helpers.rs b/substrate/core/rpc/src/helpers.rs deleted file mode 100644 index e579c743ac..0000000000 --- a/substrate/core/rpc/src/helpers.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2018-2019 Parity Technologies (UK) Ltd. -// This file is part of Substrate. - -// Substrate is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// Substrate is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with Substrate. If not, see . - -/// Unwraps the trailing parameter or falls back with the closure result. -pub fn unwrap_or_else(or_else: F, optional: Option) -> Result where - F: FnOnce() -> Result, -{ - match optional.into() { - None => or_else(), - Some(x) => Ok(x), - } -} diff --git a/substrate/core/rpc/src/lib.rs b/substrate/core/rpc/src/lib.rs index 9ce9f82fda..1341acb63d 100644 --- a/substrate/core/rpc/src/lib.rs +++ b/substrate/core/rpc/src/lib.rs @@ -20,7 +20,6 @@ #![warn(missing_docs)] -mod helpers; mod metadata; pub use api::Subscriptions; diff --git a/substrate/core/rpc/src/state/state_full.rs b/substrate/core/rpc/src/state/state_full.rs index cd05093c3a..ff4c5e5599 100644 --- a/substrate/core/rpc/src/state/state_full.rs +++ b/substrate/core/rpc/src/state/state_full.rs @@ -77,7 +77,7 @@ impl FullState /// Returns given block hash or best block hash if None is passed. fn block_or_best(&self, hash: Option) -> ClientResult { - crate::helpers::unwrap_or_else(|| Ok(self.client.info().chain.best_hash), hash) + Ok(hash.unwrap_or_else(|| self.client.info().chain.best_hash)) } /// Splits the `query_storage` block range into 'filtered' and 'unfiltered' subranges.