Skip to content

Commit

Permalink
fmt changes
Browse files Browse the repository at this point in the history
  • Loading branch information
seemantaggarwal committed Jan 26, 2025
1 parent f971aa6 commit a7c1723
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
7 changes: 4 additions & 3 deletions substrate/frame/scheduler/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,23 +143,24 @@ fn make_origin<T: Config>(signed: bool) -> <T as Config>::PalletsOrigin {

#[benchmarks]
mod benchmarks {
use frame_benchmarking::BenchmarkParameter::s;
use super::*;
use frame_benchmarking::BenchmarkParameter::s;

// `service_agenda` when no work is done.
#[benchmark]
fn service_agendas_base() {
let now = BlockNumberFor::<T>::from(block_number::<T>());
let mut set = BoundedBTreeSet::<_, _>::default();
set.try_insert(now + One::one()).unwrap(); // Insert the element
set.try_insert(now + One::one()).unwrap(); // Insert the element
Queue::<T>::put(set);

#[block]
{
Pallet::<T>::service_agendas(&mut WeightMeter::new(), now, 0);
}

let mut expected_set = BoundedBTreeSet::<BlockNumberFor<T>, T::MaxScheduledBlocks>::default();
let mut expected_set =
BoundedBTreeSet::<BlockNumberFor<T>, T::MaxScheduledBlocks>::default();
expected_set.try_insert(now + One::one()).unwrap();
assert_eq!(Queue::<T>::get(), expected_set);
}
Expand Down
8 changes: 5 additions & 3 deletions substrate/frame/scheduler/src/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -612,10 +612,9 @@ pub mod v5 {

#[cfg(test)]
pub mod test_v5 {
use frame_support::BoundedBTreeSet;
use super::*;
use crate::{migration::v5::IncompleteSince, mock::*};
use frame_support::testing_prelude::*;
use frame_support::{testing_prelude::*, BoundedBTreeSet};

#[test]
fn migration_v4_to_v5_works() {
Expand All @@ -635,7 +634,10 @@ pub mod test_v5 {

assert_eq!(StorageVersion::get::<Scheduler>(), 5);
assert_eq!(IncompleteSince::<Test>::get(), None);
let mut queue = BoundedBTreeSet::<BlockNumberFor<Test>, <Test as Config>::MaxScheduledBlocks>::default();
let mut queue = BoundedBTreeSet::<
BlockNumberFor<Test>,
<Test as Config>::MaxScheduledBlocks,
>::default();
for block in vec![2, 3] {
queue.try_insert(block).expect("BoundedBTreeSet insertion failed");
}
Expand Down
2 changes: 1 addition & 1 deletion substrate/frame/scheduler/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3081,7 +3081,7 @@ fn stale_task_is_removed() {
root(),
Preimage::bound(call).unwrap()
));
assert!(Agenda::<Test>::get(4).len() == 1);
assert_eq!(Agenda::<Test>::get(4).len(), 1);
assert!(Queue::<Test>::get().contains(&4));

go_to_block(20);
Expand Down

0 comments on commit a7c1723

Please sign in to comment.