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
+39 -29
View File
@@ -941,8 +941,8 @@ impl NoShowStats {
// Print the no-show stats if NO_SHOW_DUMP_FREQUENCY blocks have passed since the last
// print.
fn maybe_print(&mut self, current_block_number: BlockNumber) {
if self.last_dumped_block_number > current_block_number ||
current_block_number - self.last_dumped_block_number < NO_SHOW_DUMP_FREQUENCY
if self.last_dumped_block_number > current_block_number
|| current_block_number - self.last_dumped_block_number < NO_SHOW_DUMP_FREQUENCY
{
return;
}
@@ -1763,10 +1763,12 @@ fn get_core_indices_on_startup(
) -> CoreBitfield {
match &assignment {
AssignmentCertKindV2::RelayVRFModuloCompact { core_bitfield } => core_bitfield.clone(),
AssignmentCertKindV2::RelayVRFModulo { sample: _ } =>
CoreBitfield::try_from(vec![block_entry_core_index]).expect("Not an empty vec; qed"),
AssignmentCertKindV2::RelayVRFDelay { core_index } =>
CoreBitfield::try_from(vec![*core_index]).expect("Not an empty vec; qed"),
AssignmentCertKindV2::RelayVRFModulo { sample: _ } => {
CoreBitfield::try_from(vec![block_entry_core_index]).expect("Not an empty vec; qed")
},
AssignmentCertKindV2::RelayVRFDelay { core_index } => {
CoreBitfield::try_from(vec![*core_index]).expect("Not an empty vec; qed")
},
}
}
@@ -1779,8 +1781,9 @@ fn get_assignment_core_indices(
block_entry: &BlockEntry,
) -> Option<CoreBitfield> {
match &assignment {
AssignmentCertKindV2::RelayVRFModuloCompact { core_bitfield } =>
Some(core_bitfield.clone()),
AssignmentCertKindV2::RelayVRFModuloCompact { core_bitfield } => {
Some(core_bitfield.clone())
},
AssignmentCertKindV2::RelayVRFModulo { sample: _ } => block_entry
.candidates()
.iter()
@@ -1788,8 +1791,9 @@ fn get_assignment_core_indices(
.map(|(core_index, _candidate_hash)| {
CoreBitfield::try_from(vec![*core_index]).expect("Not an empty vec; qed")
}),
AssignmentCertKindV2::RelayVRFDelay { core_index } =>
Some(CoreBitfield::try_from(vec![*core_index]).expect("Not an empty vec; qed")),
AssignmentCertKindV2::RelayVRFDelay { core_index } => {
Some(CoreBitfield::try_from(vec![*core_index]).expect("Not an empty vec; qed"))
},
}
}
@@ -2701,13 +2705,14 @@ where
let block_entry = match db.load_block_entry(&assignment.block_hash)? {
Some(b) => b,
None =>
None => {
return Ok((
AssignmentCheckResult::Bad(AssignmentCheckError::UnknownBlock(
assignment.block_hash,
)),
Vec::new(),
)),
))
},
};
let session_info = match get_session_info_by_index(
@@ -2719,13 +2724,14 @@ where
.await
{
Some(s) => s,
None =>
None => {
return Ok((
AssignmentCheckResult::Bad(AssignmentCheckError::UnknownSessionIndex(
block_entry.session(),
)),
Vec::new(),
)),
))
},
};
let n_cores = session_info.n_cores as usize;
@@ -2756,25 +2762,27 @@ where
let (claimed_core_index, assigned_candidate_hash) =
match block_entry.candidate(candidate_index) {
Some((c, h)) => (*c, *h),
None =>
None => {
return Ok((
AssignmentCheckResult::Bad(AssignmentCheckError::InvalidCandidateIndex(
candidate_index as _,
)),
Vec::new(),
)), // no candidate at core.
))
}, // no candidate at core.
};
let mut candidate_entry = match db.load_candidate_entry(&assigned_candidate_hash)? {
Some(c) => c,
None =>
None => {
return Ok((
AssignmentCheckResult::Bad(AssignmentCheckError::InvalidCandidate(
candidate_index as _,
assigned_candidate_hash,
)),
Vec::new(),
)), // no candidate at core.
))
}, // no candidate at core.
};
if candidate_entry.approval_entry_mut(&assignment.block_hash).is_none() {
@@ -2811,26 +2819,28 @@ where
{
let mut candidate_entry = match db.load_candidate_entry(&assigned_candidate_hash)? {
Some(c) => c,
None =>
None => {
return Ok((
AssignmentCheckResult::Bad(AssignmentCheckError::InvalidCandidate(
candidate_index as _,
*assigned_candidate_hash,
)),
Vec::new(),
)),
))
},
};
let approval_entry = match candidate_entry.approval_entry_mut(&assignment.block_hash) {
Some(a) => a,
None =>
None => {
return Ok((
AssignmentCheckResult::Bad(AssignmentCheckError::Internal(
assignment.block_hash,
*assigned_candidate_hash,
)),
Vec::new(),
)),
))
},
};
let is_duplicate_for_candidate = approval_entry.is_assigned(assignment.validator);
@@ -3024,8 +3034,8 @@ enum ApprovalStateTransition {
impl ApprovalStateTransition {
fn validator_index(&self) -> Option<ValidatorIndex> {
match *self {
ApprovalStateTransition::RemoteApproval(v) |
ApprovalStateTransition::LocalApproval(v) => Some(v),
ApprovalStateTransition::RemoteApproval(v)
| ApprovalStateTransition::LocalApproval(v) => Some(v),
ApprovalStateTransition::WakeupProcessed => None,
}
}
@@ -3210,9 +3220,9 @@ where
.as_ref()
.map(|validator_index| fork_approval_entry.is_assigned(*validator_index))
.unwrap_or_default();
if wakeups.wakeup_for(*fork_block_hash, candidate_hash).is_none() &&
!fork_approval_entry.is_approved() &&
assigned_on_fork_block
if wakeups.wakeup_for(*fork_block_hash, candidate_hash).is_none()
&& !fork_approval_entry.is_approved()
&& assigned_on_fork_block
{
let fork_block_entry = db.load_block_entry(fork_block_hash);
if let Ok(Some(fork_block_entry)) = fork_block_entry {
@@ -3275,8 +3285,8 @@ fn should_trigger_assignment(
RequiredTranches::Pending { maximum_broadcast, clock_drift, .. } => {
let drifted_tranche_now =
tranche_now.saturating_sub(clock_drift as DelayTranche);
assignment.tranche() <= maximum_broadcast &&
assignment.tranche() <= drifted_tranche_now
assignment.tranche() <= maximum_broadcast
&& assignment.tranche() <= drifted_tranche_now
},
RequiredTranches::Exact { .. } => {
// indicates that no new assignments are needed at the moment.