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:
2025-12-22 17:12:58 +03:00
parent 65b7f5e640
commit 4c8f281051
898 changed files with 8671 additions and 6432 deletions
@@ -551,8 +551,9 @@ mod benchmarks {
for i in 0..r {
if let Some(value) = ReferendumInfoOf::<T>::get(i) {
match value {
ReferendumInfo::Finished { .. } =>
return Err("Referendum has been finished".into()),
ReferendumInfo::Finished { .. } => {
return Err("Referendum has been finished".into())
},
ReferendumInfo::Ongoing(_) => (),
}
}
@@ -589,8 +590,9 @@ mod benchmarks {
for i in 0..r {
if let Some(value) = ReferendumInfoOf::<T>::get(i) {
match value {
ReferendumInfo::Finished { .. } =>
return Err("Referendum has been finished".into()),
ReferendumInfo::Finished { .. } => {
return Err("Referendum has been finished".into())
},
ReferendumInfo::Ongoing(_) => (),
}
}
+2 -2
View File
@@ -1670,8 +1670,8 @@ impl<T: Config> Pezpallet<T> {
// of unbaked referendum is bounded by this number. In case those number have changed in a
// runtime upgrade the formula should be adjusted but the bound should still be sensible.
LowestUnbaked::<T>::mutate(|ref_index| {
while *ref_index < last &&
ReferendumInfoOf::<T>::get(*ref_index)
while *ref_index < last
&& ReferendumInfoOf::<T>::get(*ref_index)
.map_or(true, |info| matches!(info, ReferendumInfo::Finished { .. }))
{
*ref_index += 1
@@ -192,8 +192,8 @@ where
let bugged_deposits = all_accounts
.iter()
.filter(|account| {
account_deposits.get(&account).unwrap_or(&Zero::zero()) >
account_reserved_before.get(&account).unwrap_or(&Zero::zero())
account_deposits.get(&account).unwrap_or(&Zero::zero())
> account_reserved_before.get(&account).unwrap_or(&Zero::zero())
})
.count();
@@ -92,16 +92,18 @@ pub mod v1 {
weight.saturating_accrue(T::DbWeight::get().reads_writes(1, 1));
log::info!(target: TARGET, "migrating referendum #{:?}", &index);
Some(match old {
ReferendumInfo::Ongoing(status) =>
ReferendumInfo::Ongoing(status) => {
ReferendumInfo::Ongoing(ReferendumStatus {
end: status.end,
proposal: Bounded::from_legacy_hash(status.proposal),
threshold: status.threshold,
delay: status.delay,
tally: status.tally,
}),
ReferendumInfo::Finished { approved, end } =>
ReferendumInfo::Finished { approved, end },
})
},
ReferendumInfo::Finished { approved, end } => {
ReferendumInfo::Finished { approved, end }
},
})
},
);
+6 -4
View File
@@ -98,8 +98,9 @@ impl<Balance: Saturating> AccountVote<Balance> {
pub fn locked_if(self, approved: bool) -> Option<(u32, Balance)> {
// winning side: can only be removed after the lock period ends.
match self {
AccountVote::Standard { vote, balance } if vote.aye == approved =>
Some((vote.conviction.lock_periods(), balance)),
AccountVote::Standard { vote, balance } if vote.aye == approved => {
Some((vote.conviction.lock_periods(), balance))
},
_ => None,
}
}
@@ -215,8 +216,9 @@ impl<
/// The amount of this account's balance that must currently be locked due to voting.
pub fn locked_balance(&self) -> Balance {
match self {
Voting::Direct { votes, prior, .. } =>
votes.iter().map(|i| i.1.balance()).fold(prior.locked(), |a, i| a.max(i)),
Voting::Direct { votes, prior, .. } => {
votes.iter().map(|i| i.1.balance()).fold(prior.locked(), |a, i| a.max(i))
},
Voting::Delegating { balance, prior, .. } => *balance.max(&prior.locked()),
}
}
@@ -107,10 +107,12 @@ impl<
return false;
}
match *self {
VoteThreshold::SuperMajorityApprove =>
compare_rationals(tally.nays, sqrt_voters, tally.ayes, sqrt_electorate),
VoteThreshold::SuperMajorityAgainst =>
compare_rationals(tally.nays, sqrt_electorate, tally.ayes, sqrt_voters),
VoteThreshold::SuperMajorityApprove => {
compare_rationals(tally.nays, sqrt_voters, tally.ayes, sqrt_electorate)
},
VoteThreshold::SuperMajorityAgainst => {
compare_rationals(tally.nays, sqrt_electorate, tally.ayes, sqrt_voters)
},
VoteThreshold::SimpleMajority => tally.ayes > tally.nays,
}
}