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
+11 -11
View File
@@ -113,17 +113,17 @@ impl ServiceBranch {
NotQueued => T::WeightInfo::place_decision_deposit_not_queued(),
BeginDecidingPassing => T::WeightInfo::place_decision_deposit_passing(),
BeginDecidingFailing => T::WeightInfo::place_decision_deposit_failing(),
BeginConfirming |
ContinueConfirming |
EndConfirming |
ContinueNotConfirming |
Approved |
Rejected |
RequeuedInsertion |
RequeuedSlide |
TimedOut |
Fail |
NoDeposit => return None,
BeginConfirming
| ContinueConfirming
| EndConfirming
| ContinueNotConfirming
| Approved
| Rejected
| RequeuedInsertion
| RequeuedSlide
| TimedOut
| Fail
| NoDeposit => return None,
};
Some(ref_time_weight)
+8 -8
View File
@@ -931,8 +931,8 @@ impl<T: Config<I>, I: 'static> Pezpallet<T, I> {
let alarm_interval = T::AlarmInterval::get().max(One::one());
// Alarm must go off no earlier than `when`.
// This rounds `when` upwards to the next multiple of `alarm_interval`.
let when = (when.saturating_add(alarm_interval.saturating_sub(One::one())) /
alarm_interval)
let when = (when.saturating_add(alarm_interval.saturating_sub(One::one()))
/ alarm_interval)
.saturating_mul(alarm_interval);
let result = T::Scheduler::schedule(
DispatchTime::At(when),
@@ -1321,8 +1321,8 @@ impl<T: Config<I>, I: 'static> Pezpallet<T, I> {
id: TrackIdOf<T, I>,
) -> bool {
let x = Perbill::from_rational(elapsed.min(period), period);
support_needed.passing(x, tally.support(id)) &&
approval_needed.passing(x, tally.approval(id))
support_needed.passing(x, tally.support(id))
&& approval_needed.passing(x, tally.approval(id))
}
/// Clear metadata if exist for a given referendum index.
@@ -1344,8 +1344,8 @@ impl<T: Config<I>, I: 'static> Pezpallet<T, I> {
#[cfg(any(feature = "try-runtime", test))]
fn do_try_state() -> Result<(), pezsp_runtime::TryRuntimeError> {
ensure!(
ReferendumCount::<T, I>::get() as usize ==
ReferendumInfoFor::<T, I>::iter_keys().count(),
ReferendumCount::<T, I>::get() as usize
== ReferendumInfoFor::<T, I>::iter_keys().count(),
"Number of referenda in `ReferendumInfoFor` is different than `ReferendumCount`"
);
@@ -1383,8 +1383,8 @@ impl<T: Config<I>, I: 'static> Pezpallet<T, I> {
if let Some(deciding) = status.deciding {
ensure!(
deciding.since <
deciding
deciding.since
< deciding
.confirming
.unwrap_or(BlockNumberFor::<T, I>::max_value()),
"Deciding status cannot begin before confirming stage."
+12 -8
View File
@@ -152,14 +152,18 @@ pub mod v1 {
v0::ReferendumInfoFor::<T, I>::iter().for_each(|(key, value)| {
let maybe_new_value = match value {
v0::ReferendumInfo::Ongoing(_) | v0::ReferendumInfo::Killed(_) => None,
v0::ReferendumInfo::Approved(e, s, d) =>
Some(ReferendumInfo::Approved(e, Some(s), d)),
v0::ReferendumInfo::Rejected(e, s, d) =>
Some(ReferendumInfo::Rejected(e, Some(s), d)),
v0::ReferendumInfo::Cancelled(e, s, d) =>
Some(ReferendumInfo::Cancelled(e, Some(s), d)),
v0::ReferendumInfo::TimedOut(e, s, d) =>
Some(ReferendumInfo::TimedOut(e, Some(s), d)),
v0::ReferendumInfo::Approved(e, s, d) => {
Some(ReferendumInfo::Approved(e, Some(s), d))
},
v0::ReferendumInfo::Rejected(e, s, d) => {
Some(ReferendumInfo::Rejected(e, Some(s), d))
},
v0::ReferendumInfo::Cancelled(e, s, d) => {
Some(ReferendumInfo::Cancelled(e, Some(s), d))
},
v0::ReferendumInfo::TimedOut(e, s, d) => {
Some(ReferendumInfo::TimedOut(e, Some(s), d))
},
};
if let Some(new_value) = maybe_new_value {
weight.saturating_accrue(T::DbWeight::get().reads_writes(1, 1));
+15 -10
View File
@@ -394,8 +394,9 @@ impl<
Ongoing(x) if x.decision_deposit.is_none() => Ok(None),
// Cannot refund deposit if Ongoing as this breaks assumptions.
Ongoing(_) => Err(()),
Approved(_, _, d) | Rejected(_, _, d) | TimedOut(_, _, d) | Cancelled(_, _, d) =>
Ok(d.take()),
Approved(_, _, d) | Rejected(_, _, d) | TimedOut(_, _, d) | Cancelled(_, _, d) => {
Ok(d.take())
},
Killed(_) => Ok(None),
}
}
@@ -567,10 +568,12 @@ impl Curve {
/// Determine the `y` value for the given `x` value.
pub fn threshold(&self, x: Perbill) -> Perbill {
match self {
Self::LinearDecreasing { length, floor, ceil } =>
*ceil - (x.min(*length).saturating_div(*length, Down) * (*ceil - *floor)),
Self::SteppedDecreasing { begin, end, step, period } =>
(*begin - (step.int_mul(x.int_div(*period))).min(*begin)).max(*end),
Self::LinearDecreasing { length, floor, ceil } => {
*ceil - (x.min(*length).saturating_div(*length, Down) * (*ceil - *floor))
},
Self::SteppedDecreasing { begin, end, step, period } => {
(*begin - (step.int_mul(x.int_div(*period))).min(*begin)).max(*end)
},
Self::Reciprocal { factor, x_offset, y_offset } => factor
.checked_rounding_div(FixedI64::from(x) + *x_offset, Low)
.map(|yp| (yp + *y_offset).into_clamped_perthing())
@@ -609,20 +612,22 @@ impl Curve {
/// ```
pub fn delay(&self, y: Perbill) -> Perbill {
match self {
Self::LinearDecreasing { length, floor, ceil } =>
Self::LinearDecreasing { length, floor, ceil } => {
if y < *floor {
Perbill::one()
} else if y > *ceil {
Perbill::zero()
} else {
(*ceil - y).saturating_div(*ceil - *floor, Up).saturating_mul(*length)
},
Self::SteppedDecreasing { begin, end, step, period } =>
}
},
Self::SteppedDecreasing { begin, end, step, period } => {
if y < *end {
Perbill::one()
} else {
period.int_mul((*begin - y.min(*begin) + step.less_epsilon()).int_div(*step))
},
}
},
Self::Reciprocal { factor, x_offset, y_offset } => {
let y = FixedI64::from(y);
let maybe_term = factor.checked_rounding_div(y - *y_offset, High);