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
@@ -1769,7 +1769,7 @@ impl<T: Config> Pezpallet<T> {
match SignedSubmissionNextIndex::<T>::get() {
0 => Ok(()),
next =>
next => {
if SignedSubmissionsMap::<T>::get(next).is_some() {
return Err(
"The next submissions index should not be in the submissions maps already"
@@ -1777,7 +1777,8 @@ impl<T: Config> Pezpallet<T> {
);
} else {
Ok(())
},
}
},
}
}
@@ -1786,12 +1787,13 @@ impl<T: Config> Pezpallet<T> {
fn try_state_phase_off() -> Result<(), TryRuntimeError> {
match CurrentPhase::<T>::get().is_off() {
false => Ok(()),
true =>
true => {
if Snapshot::<T>::get().is_some() {
Err("Snapshot must be none when in Phase::Off".into())
} else {
Ok(())
},
}
},
}
}
}
@@ -2749,8 +2751,8 @@ mod tests {
let mut active = 1;
while weight_with(active)
.all_lte(<Runtime as pezframe_system::Config>::BlockWeights::get().max_block) ||
active == all_voters
.all_lte(<Runtime as pezframe_system::Config>::BlockWeights::get().max_block)
|| active == all_voters
{
active += 1;
}
@@ -400,10 +400,12 @@ impl MinerConfig for Runtime {
(10 as u64).saturating_add((5 as u64).saturating_mul(a as u64)),
0,
),
MockedWeightInfo::Complex =>
Weight::from_parts((0 * v + 0 * t + 1000 * a + 0 * d) as u64, 0),
MockedWeightInfo::Real =>
<() as multi_phase::weights::WeightInfo>::feasibility_check(v, t, a, d),
MockedWeightInfo::Complex => {
Weight::from_parts((0 * v + 0 * t + 1000 * a + 0 * d) as u64, 0)
},
MockedWeightInfo::Real => {
<() as multi_phase::weights::WeightInfo>::feasibility_check(v, t, a, d)
},
}
}
}
@@ -494,8 +496,8 @@ impl ElectionDataProvider for StakingMock {
let targets = Targets::get();
if !DataProviderAllowBadData::get() &&
bounds.count.map_or(false, |max_len| targets.len() > max_len.0 as usize)
if !DataProviderAllowBadData::get()
&& bounds.count.map_or(false, |max_len| targets.len() > max_len.0 as usize)
{
return Err("Targets too big");
}
@@ -152,8 +152,9 @@ fn save_solution<T: Config>(call: &Call<T>) -> Result<(), MinerError> {
let storage = StorageValueRef::persistent(OFFCHAIN_CACHED_CALL);
match storage.mutate::<_, (), _>(|_| Ok(call.clone())) {
Ok(_) => Ok(()),
Err(MutateStorageError::ConcurrentModification(_)) =>
Err(MinerError::FailedToStoreSolution),
Err(MutateStorageError::ConcurrentModification(_)) => {
Err(MinerError::FailedToStoreSolution)
},
Err(MutateStorageError::ValueFunctionFailed(_)) => {
// this branch should be unreachable according to the definition of
// `StorageValueRef::mutate`: that function should only ever `Err` if the closure we
@@ -354,8 +355,9 @@ impl<T: Config + CreateBare<Call<T>>> Pezpallet<T> {
|maybe_head: Result<Option<BlockNumberFor<T>>, _>| {
match maybe_head {
Ok(Some(head)) if now < head => Err("fork."),
Ok(Some(head)) if now >= head && now <= head + threshold =>
Err("recently executed."),
Ok(Some(head)) if now >= head && now <= head + threshold => {
Err("recently executed.")
},
Ok(Some(head)) if now > head + threshold => {
// we can run again now. Write the new head.
Ok(now)
@@ -372,8 +374,9 @@ impl<T: Config + CreateBare<Call<T>>> Pezpallet<T> {
// all good
Ok(_) => Ok(()),
// failed to write.
Err(MutateStorageError::ConcurrentModification(_)) =>
Err(MinerError::Lock("failed to write to offchain db (concurrent modification).")),
Err(MutateStorageError::ConcurrentModification(_)) => {
Err(MinerError::Lock("failed to write to offchain db (concurrent modification)."))
},
// fork etc.
Err(MutateStorageError::ValueFunctionFailed(why)) => Err(MinerError::Lock(why)),
}
@@ -400,8 +403,8 @@ impl<T: Config + CreateBare<Call<T>>> Pezpallet<T> {
// ensure correct number of winners.
ensure!(
DesiredTargets::<T>::get().unwrap_or_default() ==
raw_solution.solution.unique_targets().len() as u32,
DesiredTargets::<T>::get().unwrap_or_default()
== raw_solution.solution.unique_targets().len() as u32,
Error::<T>::PreDispatchWrongWinnerCount,
);
@@ -669,8 +672,8 @@ impl<T: MinerConfig> Miner<T> {
high = test;
}
}
let maximum_allowed_voters = if low < assignments.len() &&
encoded_size_of(&assignments[..low + 1])? <= max_allowed_length
let maximum_allowed_voters = if low < assignments.len()
&& encoded_size_of(&assignments[..low + 1])? <= max_allowed_length
{
low + 1
} else {
@@ -682,8 +685,8 @@ impl<T: MinerConfig> Miner<T> {
encoded_size_of(&assignments[..maximum_allowed_voters]).unwrap() <= max_allowed_length
);
debug_assert!(if maximum_allowed_voters < assignments.len() {
encoded_size_of(&assignments[..maximum_allowed_voters + 1]).unwrap() >
max_allowed_length
encoded_size_of(&assignments[..maximum_allowed_voters + 1]).unwrap()
> max_allowed_length
} else {
true
});