mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 08:11:04 +00:00
Run cargo fmt on the whole code base (#9394)
* Run cargo fmt on the whole code base * Second run * Add CI check * Fix compilation * More unnecessary braces * Handle weights * Use --all * Use correct attributes... * Fix UI tests * AHHHHHHHHH * 🤦 * Docs * Fix compilation * 🤷 * Please stop * 🤦 x 2 * More * make rustfmt.toml consistent with polkadot Co-authored-by: André Silva <andrerfosilva@gmail.com>
This commit is contained in:
@@ -22,9 +22,9 @@
|
||||
//! `CompatibleDigestItem` trait to appear in public interfaces.
|
||||
|
||||
use crate::AURA_ENGINE_ID;
|
||||
use sp_runtime::generic::DigestItem;
|
||||
use codec::{Codec, Encode};
|
||||
use sp_consensus_slots::Slot;
|
||||
use codec::{Encode, Codec};
|
||||
use sp_runtime::generic::DigestItem;
|
||||
use sp_std::fmt::Debug;
|
||||
|
||||
/// A digest item which is usable with aura consensus.
|
||||
@@ -42,9 +42,10 @@ pub trait CompatibleDigestItem<Signature>: Sized {
|
||||
fn as_aura_pre_digest(&self) -> Option<Slot>;
|
||||
}
|
||||
|
||||
impl<Signature, Hash> CompatibleDigestItem<Signature> for DigestItem<Hash> where
|
||||
impl<Signature, Hash> CompatibleDigestItem<Signature> for DigestItem<Hash>
|
||||
where
|
||||
Signature: Codec,
|
||||
Hash: Debug + Send + Sync + Eq + Clone + Codec + 'static
|
||||
Hash: Debug + Send + Sync + Eq + Clone + Codec + 'static,
|
||||
{
|
||||
fn aura_seal(signature: Signature) -> Self {
|
||||
DigestItem::Seal(AURA_ENGINE_ID, signature.encode())
|
||||
|
||||
@@ -16,8 +16,7 @@
|
||||
// limitations under the License.
|
||||
|
||||
/// Contains the inherents for the AURA module
|
||||
|
||||
use sp_inherents::{InherentIdentifier, InherentData, Error};
|
||||
use sp_inherents::{Error, InherentData, InherentIdentifier};
|
||||
|
||||
/// The Aura inherent identifier.
|
||||
pub const INHERENT_IDENTIFIER: InherentIdentifier = *b"auraslot";
|
||||
@@ -28,13 +27,13 @@ pub type InherentType = sp_consensus_slots::Slot;
|
||||
/// Auxiliary trait to extract Aura inherent data.
|
||||
pub trait AuraInherentData {
|
||||
/// Get aura inherent data.
|
||||
fn aura_inherent_data(&self) ->Result<Option<InherentType>, Error>;
|
||||
fn aura_inherent_data(&self) -> Result<Option<InherentType>, Error>;
|
||||
/// Replace aura inherent data.
|
||||
fn aura_replace_inherent_data(&mut self, new: InherentType);
|
||||
}
|
||||
|
||||
impl AuraInherentData for InherentData {
|
||||
fn aura_inherent_data(&self) ->Result<Option<InherentType>, Error> {
|
||||
fn aura_inherent_data(&self) -> Result<Option<InherentType>, Error> {
|
||||
self.get_data(&INHERENT_IDENTIFIER)
|
||||
}
|
||||
|
||||
@@ -54,9 +53,7 @@ pub struct InherentDataProvider {
|
||||
impl InherentDataProvider {
|
||||
/// Create a new instance with the given slot.
|
||||
pub fn new(slot: InherentType) -> Self {
|
||||
Self {
|
||||
slot,
|
||||
}
|
||||
Self { slot }
|
||||
}
|
||||
|
||||
/// Creates the inherent data provider by calculating the slot from the given
|
||||
@@ -65,13 +62,10 @@ impl InherentDataProvider {
|
||||
timestamp: sp_timestamp::Timestamp,
|
||||
duration: std::time::Duration,
|
||||
) -> Self {
|
||||
let slot = InherentType::from(
|
||||
(timestamp.as_duration().as_millis() / duration.as_millis()) as u64
|
||||
);
|
||||
let slot =
|
||||
InherentType::from((timestamp.as_duration().as_millis() / duration.as_millis()) as u64);
|
||||
|
||||
Self {
|
||||
slot,
|
||||
}
|
||||
Self { slot }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,10 +81,7 @@ impl sp_std::ops::Deref for InherentDataProvider {
|
||||
#[cfg(feature = "std")]
|
||||
#[async_trait::async_trait]
|
||||
impl sp_inherents::InherentDataProvider for InherentDataProvider {
|
||||
fn provide_inherent_data(
|
||||
&self,
|
||||
inherent_data: &mut InherentData,
|
||||
) ->Result<(), Error> {
|
||||
fn provide_inherent_data(&self, inherent_data: &mut InherentData) -> Result<(), Error> {
|
||||
inherent_data.put_data(INHERENT_IDENTIFIER, &self.slot)
|
||||
}
|
||||
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
use codec::{Encode, Decode, Codec};
|
||||
use sp_std::vec::Vec;
|
||||
use codec::{Codec, Decode, Encode};
|
||||
use sp_runtime::ConsensusEngineId;
|
||||
use sp_std::vec::Vec;
|
||||
|
||||
pub mod digests;
|
||||
pub mod inherents;
|
||||
@@ -46,7 +46,7 @@ pub mod sr25519 {
|
||||
|
||||
pub mod ed25519 {
|
||||
mod app_ed25519 {
|
||||
use sp_application_crypto::{app_crypto, key_types::AURA, ed25519};
|
||||
use sp_application_crypto::{app_crypto, ed25519, key_types::AURA};
|
||||
app_crypto!(ed25519, AURA);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user