Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
gavofyork committed May 21, 2022
1 parent cb042bc commit fe53b33
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
12 changes: 5 additions & 7 deletions frame/ranked-collective/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -494,13 +494,11 @@ pub mod pallet {

use sp_io::KillStorageResult::*;
match Voting::<T, I>::remove_prefix(poll_index, Some(max)) {
// AllRemoved(0) => Err(Error::<T, I>::NoneRemaining.into()),
AllRemoved(count) | SomeRemaining(count) => {
Ok(PostDispatchInfo {
actual_weight: Some(T::WeightInfo::cleanup_poll(count)),
pays_fee: if count == 0 { Pays::Yes } else { Pays::No },
})
},
// AllRemoved(0) => Err(Error::<T, I>::NoneRemaining.into()),
AllRemoved(count) | SomeRemaining(count) => Ok(PostDispatchInfo {
actual_weight: Some(T::WeightInfo::cleanup_poll(count)),
pays_fee: if count == 0 { Pays::Yes } else { Pays::No },
}),
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion frame/ranked-collective/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,6 @@ fn cleanup_works() {
e.execute_with(|| {
assert_ok!(Club::cleanup_poll(Origin::signed(4), 3, 10));
assert_eq!(Voting::<Test>::iter_prefix(3).count(), 0);
// assert_noop!(Club::cleanup_poll(Origin::signed(4), 3, 10), Error::<Test>::NoneRemaining);
// assert_noop!(Club::cleanup_poll(Origin::signed(4), 3, 10), Error::<Test>::NoneRemaining);
});
}
2 changes: 1 addition & 1 deletion frame/support/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1119,7 +1119,7 @@ pub mod tests {
DoubleMap::insert(&(key1 + 1), &(key2 + 1), &4u64);
assert!(matches!(
DoubleMap::remove_prefix(&key1, None),
sp_io::KillStorageResult::AllRemoved(0), // everything was in the overlay
sp_io::KillStorageResult::AllRemoved(0), // everything was in the overlay
));
assert_eq!(DoubleMap::get(&key1, &key2), 0u64);
assert_eq!(DoubleMap::get(&key1, &(key2 + 1)), 0u64);
Expand Down
8 changes: 4 additions & 4 deletions primitives/state-machine/src/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ where

self.mark_dirty();
let _overlay_count = self.overlay.clear_prefix(prefix);
//, Some(&self.overlay.changes)
//, Some(&self.overlay.changes)
let (all, count) = self.limit_remove_from_backend(None, Some(prefix), limit);
(all, count)
}
Expand All @@ -487,7 +487,7 @@ where

self.mark_dirty();
let _overlay_count = self.overlay.clear_child_prefix(child_info, prefix);
//, Some(&self.overlay.changes)
//, Some(&self.overlay.changes)
let (all, count) = self.limit_remove_from_backend(Some(child_info), Some(prefix), limit);
(all, count)
}
Expand Down Expand Up @@ -750,7 +750,7 @@ where
None => self.overlay.storage(key),
} {
// already deleted.
return true;
return true
}
if let Some(num) = num_deleted.checked_add(1) {
num_deleted = num;
Expand All @@ -773,7 +773,7 @@ where
None => self.overlay.storage(key),
} {
// already deleted.
return true;
return true
}
num_deleted = num_deleted.saturating_add(1);
if let Some(child_info) = child_info {
Expand Down

0 comments on commit fe53b33

Please sign in to comment.