From 039c82a2a5c2779f4b6542a7365c8ccca514d1ce Mon Sep 17 00:00:00 2001 From: emostov <32168567+emostov@users.noreply.github.com> Date: Mon, 21 Dec 2020 18:20:32 -0800 Subject: [PATCH] nightly fmt --- src/lib.rs | 4 ++-- src/metadata.rs | 50 ++++++++++++++++++++++++------------------------- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index f542bb188d..23a990d694 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -179,8 +179,8 @@ impl ClientBuilder { rpc.system_properties(), ) .await; - let metadata = metadata?; - let mortal_period = Some(metadata.derive_mortal_period()?); + let metadata = metadata?; + let mortal_period = Some(metadata.derive_mortal_period()?); Ok(Client { rpc, genesis_hash: genesis_hash?, diff --git a/src/metadata.rs b/src/metadata.rs index 3b9769b81f..fd25ef3e24 100644 --- a/src/metadata.rs +++ b/src/metadata.rs @@ -173,33 +173,33 @@ impl Metadata { } } string - } + } - /// Derive a default mortal period - pub(crate) fn derive_mortal_period(&self) -> Result { - let block_hash_count = if let Ok(system_meta) = self.module("System") { - if let Ok(count) = system_meta.constant("BlockHashCount") { - count.value::()?.into() - } else { - FALLBACK_BLOCK_HASH_COUNT - } - } else { - FALLBACK_BLOCK_HASH_COUNT - }; - let block_time = if let Ok(babe_meta) = self.module("Babe") { - if let Ok(milliseconds) = babe_meta.constant("ExpectedBlockTime") { - milliseconds.value::()? - } else { - FALLBACK_EXPECTED_BLOCK_TIME - } - } else { - FALLBACK_EXPECTED_BLOCK_TIME - }; + /// Derive a default mortal period + pub(crate) fn derive_mortal_period(&self) -> Result { + let block_hash_count = if let Ok(system_meta) = self.module("System") { + if let Ok(count) = system_meta.constant("BlockHashCount") { + count.value::()?.into() + } else { + FALLBACK_BLOCK_HASH_COUNT + } + } else { + FALLBACK_BLOCK_HASH_COUNT + }; + let block_time = if let Ok(babe_meta) = self.module("Babe") { + if let Ok(milliseconds) = babe_meta.constant("ExpectedBlockTime") { + milliseconds.value::()? + } else { + FALLBACK_EXPECTED_BLOCK_TIME + } + } else { + FALLBACK_EXPECTED_BLOCK_TIME + }; - Ok((BASELINE_MORTAL_PERIOD / block_time) - .next_power_of_two() - .min(block_hash_count.next_power_of_two())) - } + Ok((BASELINE_MORTAL_PERIOD / block_time) + .next_power_of_two() + .min(block_hash_count.next_power_of_two())) + } } #[derive(Clone, Debug)]