style: Migrate to stable-only rustfmt configuration
- Remove nightly-only features from .rustfmt.toml and vendor/ss58-registry/rustfmt.toml - Removed features: imports_granularity, wrap_comments, comment_width, reorder_impl_items, spaces_around_ranges, binop_separator, match_arm_blocks, trailing_semicolon, trailing_comma - Format all 898 affected files with stable rustfmt - Ensures long-term reliability without nightly toolchain dependency
This commit is contained in:
@@ -645,8 +645,9 @@ impl<T: Config<I>, I: 'static> Pezpallet<T, I> {
|
||||
}),
|
||||
);
|
||||
match old {
|
||||
Voting::Delegating(Delegating { .. }) =>
|
||||
return Err(Error::<T, I>::AlreadyDelegating.into()),
|
||||
Voting::Delegating(Delegating { .. }) => {
|
||||
return Err(Error::<T, I>::AlreadyDelegating.into())
|
||||
},
|
||||
Voting::Casting(Casting { votes, delegations, prior }) => {
|
||||
// here we just ensure that we're currently idling with no votes recorded.
|
||||
ensure!(votes.is_empty(), Error::<T, I>::AlreadyVoting);
|
||||
|
||||
@@ -99,8 +99,9 @@ impl Polling<TallyOf<Test>> for TestPolls {
|
||||
let mut polls = Polls::get();
|
||||
let entry = polls.get_mut(&index);
|
||||
let r = match entry {
|
||||
Some(Ongoing(ref mut tally_mut_ref, class)) =>
|
||||
f(PollStatus::Ongoing(tally_mut_ref, *class)),
|
||||
Some(Ongoing(ref mut tally_mut_ref, class)) => {
|
||||
f(PollStatus::Ongoing(tally_mut_ref, *class))
|
||||
},
|
||||
Some(Completed(when, succeeded)) => f(PollStatus::Completed(*when, *succeeded)),
|
||||
None => f(PollStatus::None),
|
||||
};
|
||||
@@ -114,8 +115,9 @@ impl Polling<TallyOf<Test>> for TestPolls {
|
||||
let mut polls = Polls::get();
|
||||
let entry = polls.get_mut(&index);
|
||||
let r = match entry {
|
||||
Some(Ongoing(ref mut tally_mut_ref, class)) =>
|
||||
f(PollStatus::Ongoing(tally_mut_ref, *class)),
|
||||
Some(Ongoing(ref mut tally_mut_ref, class)) => {
|
||||
f(PollStatus::Ongoing(tally_mut_ref, *class))
|
||||
},
|
||||
Some(Completed(when, succeeded)) => f(PollStatus::Completed(*when, *succeeded)),
|
||||
None => f(PollStatus::None),
|
||||
}?;
|
||||
|
||||
@@ -110,17 +110,21 @@ impl<Balance: Saturating> AccountVote<Balance> {
|
||||
// winning side: can only be removed after the lock period ends.
|
||||
match (self, approved) {
|
||||
// If the vote has no conviction, always return None
|
||||
(AccountVote::Standard { vote: Vote { conviction: Conviction::None, .. }, .. }, _) =>
|
||||
None,
|
||||
(AccountVote::Standard { vote: Vote { conviction: Conviction::None, .. }, .. }, _) => {
|
||||
None
|
||||
},
|
||||
|
||||
// For Standard votes, check the approval condition
|
||||
(AccountVote::Standard { vote, balance }, LockedIf::Status(is_approved))
|
||||
if vote.aye == is_approved =>
|
||||
Some((vote.conviction.lock_periods(), balance)),
|
||||
{
|
||||
Some((vote.conviction.lock_periods(), balance))
|
||||
},
|
||||
|
||||
// If LockedIf::Always, return the lock period regardless of the vote
|
||||
(AccountVote::Standard { vote, balance }, LockedIf::Always) =>
|
||||
Some((vote.conviction.lock_periods(), balance)),
|
||||
(AccountVote::Standard { vote, balance }, LockedIf::Always) => {
|
||||
Some((vote.conviction.lock_periods(), balance))
|
||||
},
|
||||
|
||||
// All other cases return None
|
||||
_ => None,
|
||||
@@ -132,8 +136,9 @@ impl<Balance: Saturating> AccountVote<Balance> {
|
||||
match self {
|
||||
AccountVote::Standard { balance, .. } => balance,
|
||||
AccountVote::Split { aye, nay } => aye.saturating_add(nay),
|
||||
AccountVote::SplitAbstain { aye, nay, abstain } =>
|
||||
aye.saturating_add(nay).saturating_add(abstain),
|
||||
AccountVote::SplitAbstain { aye, nay, abstain } => {
|
||||
aye.saturating_add(nay).saturating_add(abstain)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -307,8 +312,9 @@ where
|
||||
/// The amount of this account's balance that must currently be locked due to voting.
|
||||
pub fn locked_balance(&self) -> Balance {
|
||||
match self {
|
||||
Voting::Casting(Casting { votes, prior, .. }) =>
|
||||
votes.iter().map(|i| i.1.balance()).fold(prior.locked(), |a, i| a.max(i)),
|
||||
Voting::Casting(Casting { votes, prior, .. }) => {
|
||||
votes.iter().map(|i| i.1.balance()).fold(prior.locked(), |a, i| a.max(i))
|
||||
},
|
||||
Voting::Delegating(Delegating { balance, prior, .. }) => *balance.max(&prior.locked()),
|
||||
}
|
||||
}
|
||||
@@ -319,10 +325,12 @@ where
|
||||
prior: PriorLock<BlockNumber, Balance>,
|
||||
) {
|
||||
let (d, p) = match self {
|
||||
Voting::Casting(Casting { ref mut delegations, ref mut prior, .. }) =>
|
||||
(delegations, prior),
|
||||
Voting::Delegating(Delegating { ref mut delegations, ref mut prior, .. }) =>
|
||||
(delegations, prior),
|
||||
Voting::Casting(Casting { ref mut delegations, ref mut prior, .. }) => {
|
||||
(delegations, prior)
|
||||
},
|
||||
Voting::Delegating(Delegating { ref mut delegations, ref mut prior, .. }) => {
|
||||
(delegations, prior)
|
||||
},
|
||||
};
|
||||
*d = delegations;
|
||||
*p = prior;
|
||||
|
||||
Reference in New Issue
Block a user