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
@@ -928,9 +928,7 @@ pub mod pezpallet {
// Create appointment process
let documents: BoundedVec<BoundedVec<u8, ConstU32<1000>>, ConstU32<10>> =
vec![justification]
.try_into()
.map_err(|_| Error::<T>::CalculationOverflow)?;
vec![justification].try_into().map_err(|_| Error::<T>::CalculationOverflow)?;
let appointment_process = AppointmentProcess {
process_id,
@@ -1099,9 +1097,9 @@ pub mod pezpallet {
// For Parliament decisions, voter must be a parliament member
match proposal.decision_type {
CollectiveDecisionType::ParliamentSimpleMajority |
CollectiveDecisionType::ParliamentSuperMajority |
CollectiveDecisionType::ParliamentAbsoluteMajority => {
CollectiveDecisionType::ParliamentSimpleMajority
| CollectiveDecisionType::ParliamentSuperMajority
| CollectiveDecisionType::ParliamentAbsoluteMajority => {
// Check if voter is in parliament
let members = ParliamentMembers::<T>::get();
let is_member = members.iter().any(|m| m.account == voter);
@@ -1127,12 +1125,15 @@ pub mod pezpallet {
ActiveProposals::<T>::mutate(proposal_id, |proposal_opt| {
if let Some(proposal) = proposal_opt {
match vote {
VoteChoice::Aye =>
proposal.aye_votes = proposal.aye_votes.saturating_add(1),
VoteChoice::Nay =>
proposal.nay_votes = proposal.nay_votes.saturating_add(1),
VoteChoice::Abstain =>
proposal.abstain_votes = proposal.abstain_votes.saturating_add(1),
VoteChoice::Aye => {
proposal.aye_votes = proposal.aye_votes.saturating_add(1)
},
VoteChoice::Nay => {
proposal.nay_votes = proposal.nay_votes.saturating_add(1)
},
VoteChoice::Abstain => {
proposal.abstain_votes = proposal.abstain_votes.saturating_add(1)
},
}
proposal.votes_cast = proposal.votes_cast.saturating_add(1);
}
@@ -1350,14 +1351,15 @@ pub mod pezpallet {
winners: &[T::AccountId],
) -> Result<(), Error<T>> {
match election_type {
ElectionType::Presidential =>
ElectionType::Presidential => {
if let Some(winner) = winners.first() {
CurrentOfficials::<T>::insert(GovernmentPosition::Serok, winner);
},
}
},
ElectionType::Parliamentary => {
let current_block = pezframe_system::Pezpallet::<T>::block_number();
let term_end = current_block +
BlockNumberFor::<T>::from(4u32 * 365u32 * 24u32 * 60u32 * 10u32);
let term_end = current_block
+ BlockNumberFor::<T>::from(4u32 * 365u32 * 24u32 * 60u32 * 10u32);
let parliament_members: Result<BoundedVec<_, _>, _> = winners
.iter()
@@ -1382,10 +1384,11 @@ pub mod pezpallet {
term_start: current_block,
});
},
ElectionType::SpeakerElection =>
ElectionType::SpeakerElection => {
if let Some(winner) = winners.first() {
CurrentOfficials::<T>::insert(GovernmentPosition::MeclisBaskanı, winner);
},
}
},
_ => {},
}
Ok(())
@@ -1397,15 +1400,16 @@ pub mod pezpallet {
decision_type: &CollectiveDecisionType,
) -> Result<bool, Error<T>> {
match decision_type {
CollectiveDecisionType::ExecutiveDecision =>
Ok(CurrentOfficials::<T>::get(GovernmentPosition::Serok) ==
Some(proposer.clone())),
CollectiveDecisionType::ExecutiveDecision => {
Ok(CurrentOfficials::<T>::get(GovernmentPosition::Serok)
== Some(proposer.clone()))
},
_ => {
let is_parliamentarian = ParliamentMembers::<T>::get()
.iter()
.any(|member| member.account == *proposer);
let is_president = CurrentOfficials::<T>::get(GovernmentPosition::Serok) ==
Some(proposer.clone());
let is_president = CurrentOfficials::<T>::get(GovernmentPosition::Serok)
== Some(proposer.clone());
Ok(is_parliamentarian || is_president)
},
@@ -1415,12 +1419,15 @@ pub mod pezpallet {
/// Calculate voting threshold
fn get_voting_threshold(decision_type: &CollectiveDecisionType) -> u32 {
match decision_type {
CollectiveDecisionType::ParliamentSimpleMajority =>
(T::ParliamentSize::get() / 2) + 1,
CollectiveDecisionType::ParliamentSuperMajority =>
(T::ParliamentSize::get() * 2) / 3,
CollectiveDecisionType::ParliamentAbsoluteMajority =>
(T::ParliamentSize::get() * 3) / 4,
CollectiveDecisionType::ParliamentSimpleMajority => {
(T::ParliamentSize::get() / 2) + 1
},
CollectiveDecisionType::ParliamentSuperMajority => {
(T::ParliamentSize::get() * 2) / 3
},
CollectiveDecisionType::ParliamentAbsoluteMajority => {
(T::ParliamentSize::get() * 3) / 4
},
CollectiveDecisionType::ConstitutionalReview => (T::DiwanSize::get() * 2) / 3,
CollectiveDecisionType::ConstitutionalUnanimous => T::DiwanSize::get(),
_ => T::ParliamentSize::get() / 2 + 1,
@@ -1553,10 +1560,10 @@ impl<T: Config> Pezpallet<T> {
/// Check if an account is any type of governance member
/// Used for fee exemption in governance-related transactions
pub fn is_governance_member(who: &T::AccountId) -> bool {
Self::is_serok(who) ||
Self::is_parliament_member(who) ||
Self::is_diwan_member(who) ||
Self::is_minister(who)
Self::is_serok(who)
|| Self::is_parliament_member(who)
|| Self::is_diwan_member(who)
|| Self::is_minister(who)
}
/// Check if account is Serok (President)
@@ -41,7 +41,8 @@ pub mod v1 {
let elections_count = ActiveElections::<T>::iter().count() as u64;
let proposals_count = ActiveProposals::<T>::iter().count() as u64;
let migrated = officials_count + ministers_count + elections_count + proposals_count;
let migrated =
officials_count + ministers_count + elections_count + proposals_count;
// Update storage version
STORAGE_VERSION.put::<Pezpallet<T>>();
@@ -143,9 +144,8 @@ pub mod v1 {
pre_appointments_count,
pre_proposals_count,
pre_collective_votes_count,
): PreUpgradeState =
Decode::decode(&mut &state[..])
.map_err(|_| "Failed to decode pre-upgrade state")?;
): PreUpgradeState = Decode::decode(&mut &state[..])
.map_err(|_| "Failed to decode pre-upgrade state")?;
log::info!("🔍 Post-upgrade check for pezpallet-welati");
@@ -170,19 +170,33 @@ pub mod v1 {
let post_proposals_count = ActiveProposals::<T>::iter().count() as u32;
let post_collective_votes_count = CollectiveVotes::<T>::iter().count() as u32;
log::info!(" CurrentOfficials entries: {pre_officials_count} -> {post_officials_count}");
log::info!(" CurrentMinisters entries: {pre_ministers_count} -> {post_ministers_count}");
log::info!(" ParliamentMembers entries: {pre_parliament_count} -> {post_parliament_count}");
log::info!(
" CurrentOfficials entries: {pre_officials_count} -> {post_officials_count}"
);
log::info!(
" CurrentMinisters entries: {pre_ministers_count} -> {post_ministers_count}"
);
log::info!(
" ParliamentMembers entries: {pre_parliament_count} -> {post_parliament_count}"
);
log::info!(" DiwanMembers entries: {pre_diwan_count} -> {post_diwan_count}");
log::info!(" AppointedOfficials entries: {pre_appointed_count} -> {post_appointed_count}");
log::info!(" ActiveElections entries: {pre_elections_count} -> {post_elections_count}");
log::info!(" ElectionCandidates entries: {pre_candidates_count} -> {post_candidates_count}");
log::info!(
" AppointedOfficials entries: {pre_appointed_count} -> {post_appointed_count}"
);
log::info!(
" ActiveElections entries: {pre_elections_count} -> {post_elections_count}"
);
log::info!(
" ElectionCandidates entries: {pre_candidates_count} -> {post_candidates_count}"
);
log::info!(" ElectionVotes entries: {pre_votes_count} -> {post_votes_count}");
log::info!(" ElectionResults entries: {pre_results_count} -> {post_results_count}");
log::info!(" ElectoralDistrictConfig entries: {pre_districts_count} -> {post_districts_count}");
log::info!(" PendingNominations entries: {pre_nominations_count} -> {post_nominations_count}");
log::info!(" AppointmentProcesses entries: {pre_appointments_count} -> {post_appointments_count}");
log::info!(" ActiveProposals entries: {pre_proposals_count} -> {post_proposals_count}");
log::info!(
" ActiveProposals entries: {pre_proposals_count} -> {post_proposals_count}"
);
log::info!(" CollectiveVotes entries: {pre_collective_votes_count} -> {post_collective_votes_count}");
// Verify no data was lost
@@ -125,7 +125,9 @@ parameter_types! {
pub struct NftsBenchmarkHelper;
#[cfg(feature = "runtime-benchmarks")]
impl pezpallet_nfts::BenchmarkHelper<u32, u32, UintAuthorityId, AccountId, TestSignature> for NftsBenchmarkHelper {
impl pezpallet_nfts::BenchmarkHelper<u32, u32, UintAuthorityId, AccountId, TestSignature>
for NftsBenchmarkHelper
{
fn collection(i: u16) -> u32 {
i.into()
}
@@ -192,10 +194,13 @@ parameter_types! {
pub struct IdentityBenchmarkHelper;
#[cfg(feature = "runtime-benchmarks")]
impl pezpallet_identity::BenchmarkHelper<UintAuthorityId, TestSignature> for IdentityBenchmarkHelper {
impl pezpallet_identity::BenchmarkHelper<UintAuthorityId, TestSignature>
for IdentityBenchmarkHelper
{
fn sign_message(message: &[u8]) -> (UintAuthorityId, TestSignature) {
let signer = UintAuthorityId(0);
let signature = <UintAuthorityId as RuntimeAppPublic>::sign(&signer, &message.to_vec()).unwrap();
let signature =
<UintAuthorityId as RuntimeAppPublic>::sign(&signer, &message.to_vec()).unwrap();
(signer, signature)
}
}
@@ -1339,31 +1339,33 @@ impl OfficialRoleInfo for OfficialRole {
fn nominating_minister(&self) -> MinisterRole {
match self {
OfficialRole::Dadger |
OfficialRole::Dozger |
OfficialRole::Hiquqnas |
OfficialRole::Noter => MinisterRole::AdvaletWeziri,
OfficialRole::Dadger
| OfficialRole::Dozger
| OfficialRole::Hiquqnas
| OfficialRole::Noter => MinisterRole::AdvaletWeziri,
OfficialRole::Xezinedar | OfficialRole::Bacgir | OfficialRole::GerinendeyeCavkaniye =>
MinisterRole::XezineWeziri,
OfficialRole::Xezinedar | OfficialRole::Bacgir | OfficialRole::GerinendeyeCavkaniye => {
MinisterRole::XezineWeziri
},
OfficialRole::OperatoreTore |
OfficialRole::PisporeEwlehiyaSiber |
OfficialRole::GerinendeyeDaneye => MinisterRole::TeknolojîWeziri,
OfficialRole::OperatoreTore
| OfficialRole::PisporeEwlehiyaSiber
| OfficialRole::GerinendeyeDaneye => MinisterRole::TeknolojîWeziri,
OfficialRole::Berdevk | OfficialRole::Qeydkar => MinisterRole::NavxweWeziri,
OfficialRole::Balyoz | OfficialRole::Navbeynkar | OfficialRole::ParezvaneCandi =>
MinisterRole::DerveWeziri,
OfficialRole::Balyoz | OfficialRole::Navbeynkar | OfficialRole::ParezvaneCandi => {
MinisterRole::DerveWeziri
},
OfficialRole::Mufetis | OfficialRole::KaliteKontrolker => MinisterRole::DenetimWeziri,
OfficialRole::Bazargan | OfficialRole::RêvebereProjeyê => MinisterRole::AbûrîWeziri,
OfficialRole::Feqi |
OfficialRole::Perwerdekar |
OfficialRole::Rewsenbir |
OfficialRole::Mamoste => MinisterRole::PerwerdeDiyanetWeziri,
OfficialRole::Feqi
| OfficialRole::Perwerdekar
| OfficialRole::Rewsenbir
| OfficialRole::Mamoste => MinisterRole::PerwerdeDiyanetWeziri,
// Mela özel durum - doğrudan Serok atar
OfficialRole::Mela => MinisterRole::AdvaletWeziri, // Placeholder
@@ -1373,11 +1375,11 @@ impl OfficialRoleInfo for OfficialRole {
fn requires_parliament_approval(&self) -> bool {
match self {
// Yüksek düzey pozisyonlar Parlamento onayı gerektirir
OfficialRole::Dadger |
OfficialRole::Xezinedar |
OfficialRole::PisporeEwlehiyaSiber |
OfficialRole::Mufetis |
OfficialRole::Balyoz => true,
OfficialRole::Dadger
| OfficialRole::Xezinedar
| OfficialRole::PisporeEwlehiyaSiber
| OfficialRole::Mufetis
| OfficialRole::Balyoz => true,
// Diğerleri sadece Serok onayı
_ => false,
}