difftreelog
fix cargo fmt
in: master
3 files changed
pallets/scheduler/src/lib.rsdiffbeforeafterboth--- a/pallets/scheduler/src/lib.rs
+++ b/pallets/scheduler/src/lib.rs
@@ -197,7 +197,10 @@
use frame_support::{
dispatch::PostDispatchInfo,
pallet_prelude::*,
- traits::{schedule::{LookupError, LOWEST_PRIORITY}, PreimageProvider},
+ traits::{
+ schedule::{LookupError, LOWEST_PRIORITY},
+ PreimageProvider,
+ },
};
use frame_system::pallet_prelude::*;
@@ -239,7 +242,10 @@
type MaximumWeight: Get<Weight>;
/// Required origin to schedule or cancel calls.
- type ScheduleOrigin: EnsureOrigin<<Self as system::Config>::RuntimeOrigin, Success = ScheduledEnsureOriginSuccess<Self::AccountId>>;
+ type ScheduleOrigin: EnsureOrigin<
+ <Self as system::Config>::RuntimeOrigin,
+ Success = ScheduledEnsureOriginSuccess<Self::AccountId>,
+ >;
/// Required origin to set/change calls' priority.
type PrioritySetOrigin: EnsureOrigin<<Self as system::Config>::RuntimeOrigin>;
@@ -326,7 +332,7 @@
/// Canceled some task.
Canceled { when: T::BlockNumber, index: u32 },
/// Scheduled task's priority has changed
- PriorityChanged {
+ PriorityChanged {
when: T::BlockNumber,
index: u32,
priority: schedule::Priority,
@@ -446,19 +452,21 @@
continue;
}
- let scheduled_origin = <<T as Config>::RuntimeOrigin as From<T::PalletsOrigin>>::from(s.origin.clone());
- let ensured_origin = T::ScheduleOrigin::ensure_origin(scheduled_origin.into()).unwrap();
+ let scheduled_origin =
+ <<T as Config>::RuntimeOrigin as From<T::PalletsOrigin>>::from(s.origin.clone());
+ let ensured_origin =
+ T::ScheduleOrigin::ensure_origin(scheduled_origin.into()).unwrap();
let r;
match ensured_origin {
ScheduledEnsureOriginSuccess::Root => {
r = Ok(call.dispatch_bypass_filter(frame_system::RawOrigin::Root.into()));
- },
+ }
ScheduledEnsureOriginSuccess::Signed(sender) => {
// Execute transaction via chain default pipeline
// That means dispatch will be processed like any user's extrinsic e.g. transaction fees will be taken
r = T::CallExecutor::dispatch_call(Some(sender), call.clone());
- },
+ }
ScheduledEnsureOriginSuccess::Unsigned => {
// Unsigned version of the above
r = T::CallExecutor::dispatch_call(None, call.clone());
@@ -776,12 +784,16 @@
}
s.priority = priority;
- Self::deposit_event(Event::PriorityChanged { when, index, priority });
+ Self::deposit_event(Event::PriorityChanged {
+ when,
+ index,
+ priority,
+ });
}
Ok(())
})
- },
- None => Err(Error::<T>::NotFound.into())
+ }
+ None => Err(Error::<T>::NotFound.into()),
}
}
}
runtime/common/config/pallets/scheduler.rsdiffbeforeafterboth--- a/runtime/common/config/pallets/scheduler.rs
+++ b/runtime/common/config/pallets/scheduler.rs
@@ -14,7 +14,11 @@
// You should have received a copy of the GNU General Public License
// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
-use frame_support::{traits::{PrivilegeCmp, EnsureOrigin}, weights::Weight, parameter_types};
+use frame_support::{
+ traits::{PrivilegeCmp, EnsureOrigin},
+ weights::Weight,
+ parameter_types,
+};
use frame_system::{EnsureRoot, RawOrigin};
use sp_runtime::Perbill;
use core::cmp::Ordering;
@@ -37,7 +41,8 @@
pub struct EnsureSignedOrRoot<AccountId>(sp_std::marker::PhantomData<AccountId>);
impl<O: Into<Result<RawOrigin<AccountId>, O>> + From<RawOrigin<AccountId>>, AccountId: Decode>
- EnsureOrigin<O> for EnsureSignedOrRoot<AccountId> {
+ EnsureOrigin<O> for EnsureSignedOrRoot<AccountId>
+{
type Success = ScheduledEnsureOriginSuccess<AccountId>;
fn try_origin(o: O) -> Result<Self::Success, O> {
o.into().and_then(|o| match o {
@@ -60,7 +65,7 @@
(Root, Root) => Some(Ordering::Equal),
(Root, _) => Some(Ordering::Greater),
(_, Root) => Some(Ordering::Less),
- lr @ _ => (lr.0 == lr.1).then(|| Ordering::Equal)
+ lr @ _ => (lr.0 == lr.1).then(|| Ordering::Equal),
}
}
}
runtime/common/scheduler.rsdiffbeforeafterbothno syntactic changes