mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-28 06:17:56 +00:00
cargo +nightly fmt (#3540)
* cargo +nightly fmt * add cargo-fmt check to ci * update ci * fmt * fmt * skip macro * ignore bridges
This commit is contained in:
@@ -16,12 +16,12 @@
|
||||
|
||||
//! Mocking utilities for testing.
|
||||
|
||||
use std::{cell::RefCell, collections::HashMap};
|
||||
use parity_scale_codec::{Encode, Decode};
|
||||
use sp_runtime::traits::SaturatedConversion;
|
||||
use frame_support::dispatch::{DispatchError, DispatchResult};
|
||||
use primitives::v1::{HeadData, ValidationCode, Id as ParaId};
|
||||
use crate::traits::Registrar;
|
||||
use frame_support::dispatch::{DispatchError, DispatchResult};
|
||||
use parity_scale_codec::{Decode, Encode};
|
||||
use primitives::v1::{HeadData, Id as ParaId, ValidationCode};
|
||||
use sp_runtime::traits::SaturatedConversion;
|
||||
use std::{cell::RefCell, collections::HashMap};
|
||||
|
||||
thread_local! {
|
||||
static OPERATIONS: RefCell<Vec<(ParaId, u32, bool)>> = RefCell::new(Vec::new());
|
||||
@@ -130,9 +130,13 @@ impl<T: frame_system::Config> Registrar for TestRegistrar<T> {
|
||||
},
|
||||
}
|
||||
})?;
|
||||
OPERATIONS.with(|x| x.borrow_mut().push(
|
||||
(id, frame_system::Pallet::<T>::block_number().saturated_into(), true)
|
||||
));
|
||||
OPERATIONS.with(|x| {
|
||||
x.borrow_mut().push((
|
||||
id,
|
||||
frame_system::Pallet::<T>::block_number().saturated_into(),
|
||||
true,
|
||||
))
|
||||
});
|
||||
Ok(())
|
||||
}
|
||||
fn make_parathread(id: ParaId) -> DispatchResult {
|
||||
@@ -149,16 +153,21 @@ impl<T: frame_system::Config> Registrar for TestRegistrar<T> {
|
||||
PARATHREADS.with(|x| {
|
||||
let mut parathreads = x.borrow_mut();
|
||||
match parathreads.binary_search(&id) {
|
||||
Ok(_) => Err(DispatchError::Other("already parathread, so cannot `make_parathread`")),
|
||||
Ok(_) =>
|
||||
Err(DispatchError::Other("already parathread, so cannot `make_parathread`")),
|
||||
Err(i) => {
|
||||
parathreads.insert(i, id);
|
||||
Ok(())
|
||||
},
|
||||
}
|
||||
})?;
|
||||
OPERATIONS.with(|x| x.borrow_mut().push(
|
||||
(id, frame_system::Pallet::<T>::block_number().saturated_into(), false)
|
||||
));
|
||||
OPERATIONS.with(|x| {
|
||||
x.borrow_mut().push((
|
||||
id,
|
||||
frame_system::Pallet::<T>::block_number().saturated_into(),
|
||||
false,
|
||||
))
|
||||
});
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -179,7 +188,8 @@ impl<T: frame_system::Config> Registrar for TestRegistrar<T> {
|
||||
|
||||
impl<T: frame_system::Config> TestRegistrar<T> {
|
||||
pub fn operations() -> Vec<(ParaId, T::BlockNumber, bool)> {
|
||||
OPERATIONS.with(|x| x.borrow().iter().map(|(p, b, c)| (*p, (*b).into(), *c)).collect::<Vec<_>>())
|
||||
OPERATIONS
|
||||
.with(|x| x.borrow().iter().map(|(p, b, c)| (*p, (*b).into(), *c)).collect::<Vec<_>>())
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
|
||||
Reference in New Issue
Block a user