mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-30 08:27:55 +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:
@@ -20,23 +20,21 @@
|
||||
//!
|
||||
//! This is used instead of `futures_timer::Interval` because it was unreliable.
|
||||
|
||||
use super::{Slot, InherentDataProviderExt};
|
||||
use super::{InherentDataProviderExt, Slot};
|
||||
use sp_consensus::{Error, SelectChain};
|
||||
use sp_inherents::{InherentData, CreateInherentDataProviders, InherentDataProvider};
|
||||
use sp_inherents::{CreateInherentDataProviders, InherentData, InherentDataProvider};
|
||||
use sp_runtime::traits::{Block as BlockT, Header as HeaderT};
|
||||
|
||||
use std::time::{Duration, Instant};
|
||||
use futures_timer::Delay;
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
/// Returns current duration since unix epoch.
|
||||
pub fn duration_now() -> Duration {
|
||||
use std::time::SystemTime;
|
||||
let now = SystemTime::now();
|
||||
now.duration_since(SystemTime::UNIX_EPOCH).unwrap_or_else(|e| panic!(
|
||||
"Current time {:?} is before unix epoch. Something is wrong: {:?}",
|
||||
now,
|
||||
e,
|
||||
))
|
||||
now.duration_since(SystemTime::UNIX_EPOCH).unwrap_or_else(|e| {
|
||||
panic!("Current time {:?} is before unix epoch. Something is wrong: {:?}", now, e,)
|
||||
})
|
||||
}
|
||||
|
||||
/// Returns the duration until the next slot from now.
|
||||
@@ -104,11 +102,7 @@ pub(crate) struct Slots<Block, C, IDP> {
|
||||
|
||||
impl<Block, C, IDP> Slots<Block, C, IDP> {
|
||||
/// Create a new `Slots` stream.
|
||||
pub fn new(
|
||||
slot_duration: Duration,
|
||||
create_inherent_data_providers: IDP,
|
||||
client: C,
|
||||
) -> Self {
|
||||
pub fn new(slot_duration: Duration, create_inherent_data_providers: IDP, client: C) -> Self {
|
||||
Slots {
|
||||
last_slot: 0.into(),
|
||||
slot_duration,
|
||||
@@ -135,7 +129,7 @@ where
|
||||
// schedule wait.
|
||||
let wait_dur = time_until_next_slot(self.slot_duration);
|
||||
Some(Delay::new(wait_dur))
|
||||
}
|
||||
},
|
||||
Some(d) => Some(d),
|
||||
};
|
||||
|
||||
@@ -161,11 +155,12 @@ where
|
||||
);
|
||||
// Let's try at the next slot..
|
||||
self.inner_delay.take();
|
||||
continue;
|
||||
}
|
||||
continue
|
||||
},
|
||||
};
|
||||
|
||||
let inherent_data_providers = self.create_inherent_data_providers
|
||||
let inherent_data_providers = self
|
||||
.create_inherent_data_providers
|
||||
.create_inherent_data_providers(chain_head.hash(), ())
|
||||
.await?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user