Match substrate's fmt (#1148)

* Alter gitlab.

* Use substrate's rustfmt.toml

* cargo +nightly fmt --all

* Fix spellcheck.

* cargo +nightly fmt --all

* format.

* Fix spellcheck and fmt

* fmt?

* Fix spellcheck

Co-authored-by: Tomasz Drwięga <tomasz@parity.io>
This commit is contained in:
hacpy
2021-09-24 19:29:31 +08:00
committed by Bastian Köcher
parent 87cbb382d9
commit bd70de8b8b
174 changed files with 6095 additions and 4962 deletions
@@ -14,8 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
use crate::chain::Chain;
use crate::client::Client;
use crate::{chain::Chain, client::Client};
use async_std::sync::{Arc, RwLock};
use async_trait::async_trait;
@@ -83,7 +82,8 @@ where
.await
.map(|maybe_storage_value| {
maybe_storage_value.or(self.maybe_default_value).map(|storage_value| {
storage_value.into_inner().unique_saturated_into() as f64 / T::DIV.unique_saturated_into() as f64
storage_value.into_inner().unique_saturated_into() as f64 /
T::DIV.unique_saturated_into() as f64
})
})
.map_err(drop);
@@ -14,12 +14,12 @@
// You should have received a copy of the GNU General Public License
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
use crate::chain::Chain;
use crate::client::Client;
use crate::error::Error;
use crate::{chain::Chain, client::Client, error::Error};
use async_trait::async_trait;
use relay_utils::metrics::{metric_name, register, Gauge, PrometheusError, Registry, StandaloneMetrics, U64};
use relay_utils::metrics::{
metric_name, register, Gauge, PrometheusError, Registry, StandaloneMetrics, U64,
};
use sp_core::storage::StorageKey;
use sp_runtime::traits::Header as HeaderT;
use sp_storage::well_known_keys::CODE;
@@ -40,10 +40,7 @@ pub struct StorageProofOverheadMetric<C: Chain> {
impl<C: Chain> Clone for StorageProofOverheadMetric<C> {
fn clone(&self) -> Self {
StorageProofOverheadMetric {
client: self.client.clone(),
metric: self.metric.clone(),
}
StorageProofOverheadMetric { client: self.client.clone(), metric: self.metric.clone() }
}
}
@@ -73,15 +70,15 @@ impl<C: Chain> StorageProofOverheadMetric<C> {
.await?;
let storage_proof_size: usize = storage_proof.clone().iter_nodes().map(|n| n.len()).sum();
let storage_value_reader =
bp_runtime::StorageProofChecker::<C::Hasher>::new(*best_header.state_root(), storage_proof)
.map_err(Error::StorageProofError)?;
let maybe_encoded_storage_value = storage_value_reader
.read_value(CODE)
.map_err(Error::StorageProofError)?;
let encoded_storage_value_size = maybe_encoded_storage_value
.ok_or(Error::MissingMandatoryCodeEntry)?
.len();
let storage_value_reader = bp_runtime::StorageProofChecker::<C::Hasher>::new(
*best_header.state_root(),
storage_proof,
)
.map_err(Error::StorageProofError)?;
let maybe_encoded_storage_value =
storage_value_reader.read_value(CODE).map_err(Error::StorageProofError)?;
let encoded_storage_value_size =
maybe_encoded_storage_value.ok_or(Error::MissingMandatoryCodeEntry)?.len();
Ok(storage_proof_size - encoded_storage_value_size)
}