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
@@ -114,8 +114,9 @@ impl ExtrinsicCmd {
let extrinsic = self.params.extrinsic.clone().unwrap_or_default();
let ext_builder = match ext_factory.try_get(&pezpallet, &extrinsic) {
Some(ext_builder) => ext_builder,
None =>
return Err("Unknown pezpallet or extrinsic. Use --list for a complete list.".into()),
None => {
return Err("Unknown pezpallet or extrinsic. Use --list for a complete list.".into())
},
};
let bench =
@@ -150,8 +150,9 @@ impl MachineCmd {
let score = match metric {
Metric::Blake2256 => benchmark_cpu(hash_limit),
Metric::Blake2256Parallel { num_cores } =>
benchmark_cpu_parallelism(hash_limit, *num_cores),
Metric::Blake2256Parallel { num_cores } => {
benchmark_cpu_parallelism(hash_limit, *num_cores)
},
Metric::Sr25519Verify => benchmark_sr25519_verify(verify_limit),
Metric::MemCopy => benchmark_memory(memory_limit),
Metric::DiskSeqWrite => benchmark_disk_sequential_writes(disk_limit, dir)?,
@@ -42,6 +42,7 @@ use genesis_state::WARN_SPEC_GENESIS_CTOR;
use log::info;
use pezcumulus_client_teyrchain_inherent::MockValidationDataInherentDataProvider;
use pezframe_support::Deserialize;
use pezkuwi_subxt::{client::RuntimeVersion, ext::futures, Metadata};
use pezkuwi_teyrchain_primitives::primitives::Id as ParaId;
use pezsc_block_builder::BlockBuilderApi;
use pezsc_chain_spec::{ChainSpec, ChainSpecExtension, GenesisBlockBuilder};
@@ -70,7 +71,6 @@ use std::{
path::PathBuf,
sync::Arc,
};
use pezkuwi_subxt::{client::RuntimeVersion, ext::futures, Metadata};
const DEFAULT_PARA_ID: u32 = 100;
const LOG_TARGET: &'static str = "pezkuwi_sdk_frame::benchmark::overhead";
@@ -273,8 +273,9 @@ impl OverheadCmd {
chain_spec_from_api: Option<Box<dyn ChainSpec>>,
) -> Result<(GenesisStateHandler, Option<u32>)> {
let genesis_builder_to_source = || match self.params.genesis_builder {
Some(GenesisBuilderPolicy::Runtime) | Some(GenesisBuilderPolicy::SpecRuntime) =>
SpecGenesisSource::Runtime(self.params.genesis_builder_preset.clone()),
Some(GenesisBuilderPolicy::Runtime) | Some(GenesisBuilderPolicy::SpecRuntime) => {
SpecGenesisSource::Runtime(self.params.genesis_builder_preset.clone())
},
Some(GenesisBuilderPolicy::SpecGenesis) | None => {
log::warn!(target: LOG_TARGET, "{WARN_SPEC_GENESIS_CTOR}");
SpecGenesisSource::SpecJson
@@ -328,9 +329,9 @@ impl OverheadCmd {
&self,
chain_spec: &Option<Box<dyn ChainSpec>>,
) -> std::result::Result<(), (ErrorKind, String)> {
if chain_spec.is_none() &&
self.params.runtime.is_none() &&
self.shared_params.chain.is_none()
if chain_spec.is_none()
&& self.params.runtime.is_none()
&& self.shared_params.chain.is_none()
{
return Err((
ErrorKind::MissingRequiredArgument,
@@ -340,13 +341,14 @@ impl OverheadCmd {
}
match self.params.genesis_builder {
Some(GenesisBuilderPolicy::SpecGenesis | GenesisBuilderPolicy::SpecRuntime) =>
Some(GenesisBuilderPolicy::SpecGenesis | GenesisBuilderPolicy::SpecRuntime) => {
if chain_spec.is_none() && self.shared_params.chain.is_none() {
return Err((
ErrorKind::MissingRequiredArgument,
"Provide a chain spec via `--chain`.".to_string(),
));
},
}
},
_ => {},
};
Ok(())
@@ -414,8 +416,9 @@ impl OverheadCmd {
// If we are dealing with a teyrchain, make sure that the para id in genesis will
// match what we expect.
let genesis_patcher = match chain_type {
Teyrchain(para_id) =>
Some(Box::new(move |value| patch_genesis(value, Some(para_id))) as Box<_>),
Teyrchain(para_id) => {
Some(Box::new(move |value| patch_genesis(value, Some(para_id))) as Box<_>)
},
_ => None,
};
@@ -17,15 +17,15 @@
use crate::extrinsic::ExtrinsicBuilder;
use codec::{Decode, Encode};
use pezkuwi_subxt::{
client::RuntimeVersion as SubxtRuntimeVersion,
config::{bizinikiwi::BizinikiwiExtrinsicParamsBuilder as ParamsBuilder, HashFor},
BizinikiwConfig, Config, OfflineClient,
};
use pezsc_client_api::UsageProvider;
use pezsp_api::{ApiExt, Core, Metadata, ProvideRuntimeApi};
use pezsp_runtime::{traits::Block as BlockT, OpaqueExtrinsic};
use std::sync::Arc;
use pezkuwi_subxt::{
client::RuntimeVersion as SubxtRuntimeVersion,
config::{bizinikiwi::BizinikiwiExtrinsicParamsBuilder as ParamsBuilder, HashFor},
Config, OfflineClient, BizinikiwConfig,
};
/// Bizinikiwi configuration
pub type BizinikiwiConfig = BizinikiwConfig;
@@ -166,8 +166,9 @@ impl PalletCmd {
chain_spec_from_api: Option<Box<dyn ChainSpec>>,
) -> Result<GenesisStateHandler> {
let genesis_builder_to_source = || match self.genesis_builder {
Some(GenesisBuilderPolicy::Runtime) | Some(GenesisBuilderPolicy::SpecRuntime) =>
SpecGenesisSource::Runtime(self.genesis_builder_preset.clone()),
Some(GenesisBuilderPolicy::Runtime) | Some(GenesisBuilderPolicy::SpecRuntime) => {
SpecGenesisSource::Runtime(self.genesis_builder_preset.clone())
},
Some(GenesisBuilderPolicy::SpecGenesis) | None => {
log::warn!(target: LOG_TARGET, "{WARN_SPEC_GENESIS_CTOR}");
SpecGenesisSource::SpecJson
@@ -244,13 +245,15 @@ impl PalletCmd {
if let Some(json_input) = &self.json_input {
let raw_data = match std::fs::read(json_input) {
Ok(raw_data) => raw_data,
Err(error) =>
return Err(format!("Failed to read {:?}: {}", json_input, error).into()),
Err(error) => {
return Err(format!("Failed to read {:?}: {}", json_input, error).into())
},
};
let batches: Vec<BenchmarkBatchSplitResults> = match serde_json::from_slice(&raw_data) {
Ok(batches) => batches,
Err(error) =>
return Err(format!("Failed to deserialize {:?}: {}", json_input, error).into()),
Err(error) => {
return Err(format!("Failed to deserialize {:?}: {}", json_input, error).into())
},
};
return self.output_from_results(&batches);
}
@@ -632,10 +635,10 @@ impl PalletCmd {
fn pezpallet_selected(&self, pezpallet: &Vec<u8>) -> bool {
let include = self.pallets.clone();
let included = include.is_empty() ||
include.iter().any(|p| p.as_bytes() == pezpallet) ||
include.iter().any(|p| p == "*") ||
include.iter().any(|p| p == "all");
let included = include.is_empty()
|| include.iter().any(|p| p.as_bytes() == pezpallet)
|| include.iter().any(|p| p == "*")
|| include.iter().any(|p| p == "all");
let excluded = self.exclude_pallets.iter().any(|p| p.as_bytes() == pezpallet);
included && !excluded
@@ -651,10 +654,10 @@ impl PalletCmd {
let extrinsic_split: Vec<&str> = extrinsic_filter.split(',').collect();
let extrinsics: Vec<_> = extrinsic_split.iter().map(|x| x.trim().as_bytes()).collect();
let included = extrinsic_filter.is_empty() ||
extrinsic_filter == "*" ||
extrinsic_filter == "all" ||
extrinsics.contains(&&extrinsic[..]);
let included = extrinsic_filter.is_empty()
|| extrinsic_filter == "*"
|| extrinsic_filter == "all"
|| extrinsics.contains(&&extrinsic[..]);
let excluded = self
.excluded_extrinsics()
@@ -964,12 +967,13 @@ impl PalletCmd {
.or_default()
.entry((pov_pallet.to_string(), pov_storage.to_string()))
{
Entry::Occupied(_) =>
Entry::Occupied(_) => {
return Err(format!(
"Cannot specify pov_mode tag twice for the same key: {}",
pezpallet_storage
)
.into()),
.into())
},
Entry::Vacant(e) => {
e.insert(mode);
},
@@ -1031,13 +1035,14 @@ impl PalletCmd {
}
match self.genesis_builder {
Some(GenesisBuilderPolicy::SpecGenesis | GenesisBuilderPolicy::SpecRuntime) =>
Some(GenesisBuilderPolicy::SpecGenesis | GenesisBuilderPolicy::SpecRuntime) => {
if chain_spec.is_none() && self.shared_params.chain.is_none() {
return Err((
ErrorKind::MissingRequiredArgument,
"Provide a chain spec via `--chain`.".to_string(),
));
},
}
},
_ => {},
}
@@ -583,8 +583,9 @@ pub(crate) fn process_storage_results(
let mut prefix_result = result.clone();
let key_info = storage_info_map.get(&prefix);
let pezpallet_name = match key_info {
Some(k) =>
String::from_utf8(k.pezpallet_name.clone()).expect("encoded from string"),
Some(k) => {
String::from_utf8(k.pezpallet_name.clone()).expect("encoded from string")
},
None => "".to_string(),
};
let storage_name = match key_info {
@@ -606,8 +607,8 @@ pub(crate) fn process_storage_results(
},
None => None,
};
let is_all_ignored = pov_modes.get(&("ALL".to_string(), "ALL".to_string())) ==
Some(&PovEstimationMode::Ignored);
let is_all_ignored = pov_modes.get(&("ALL".to_string(), "ALL".to_string()))
== Some(&PovEstimationMode::Ignored);
if is_all_ignored && override_pov_mode != Some(&PovEstimationMode::Ignored) {
panic!("The syntax currently does not allow to exclude single keys from a top-level `Ignored` pov-mode.");
}
@@ -75,8 +75,9 @@ impl GenesisStateHandler {
.map_err(|e| format!("{ERROR_CANNOT_BUILD_GENESIS}\nError: {e}").into()),
SpecGenesisSource::None => Ok(Storage::default()),
},
GenesisStateHandler::Runtime(code_bytes, Some(preset)) =>
genesis_from_code::<HF>(code_bytes.as_slice(), preset, json_patcher),
GenesisStateHandler::Runtime(code_bytes, Some(preset)) => {
genesis_from_code::<HF>(code_bytes.as_slice(), preset, json_patcher)
},
GenesisStateHandler::Runtime(_, None) => Ok(Storage::default()),
}
}
@@ -48,8 +48,8 @@ impl StorageCmd {
if self.params.is_validate_block_mode() && self.params.disable_pov_recorder {
return Err("PoV recorder must be activated to provide a storage proof for block validation at runtime. Remove `--disable-pov-recorder` from the command line.".into());
}
if self.params.is_validate_block_mode() &&
self.params.batch_size > MAX_BATCH_SIZE_FOR_BLOCK_VALIDATION
if self.params.is_validate_block_mode()
&& self.params.batch_size > MAX_BATCH_SIZE_FOR_BLOCK_VALIDATION
{
return Err(format!("Batch size is too large. This may cause problems with runtime memory allocation. Better set `--batch-size {}` or less.", MAX_BATCH_SIZE_FOR_BLOCK_VALIDATION).into());
}
@@ -158,8 +158,8 @@ impl StorageCmd {
record.append(v.len(), start.elapsed())?;
}
read_in_batch += 1;
let is_batch_full = read_in_batch >= self.params.batch_size ||
(last_child_key == key && last_child_info == info);
let is_batch_full = read_in_batch >= self.params.batch_size
|| (last_child_key == key && last_child_info == info);
// Read child keys on block validation
if is_batch_full && self.params.is_validate_block_mode() {
@@ -61,8 +61,8 @@ impl StorageCmd {
if self.params.is_validate_block_mode() && self.params.disable_pov_recorder {
return Err("PoV recorder must be activated to provide a storage proof for block validation at runtime. Remove `--disable-pov-recorder`.".into());
}
if self.params.is_validate_block_mode() &&
self.params.batch_size > MAX_BATCH_SIZE_FOR_BLOCK_VALIDATION
if self.params.is_validate_block_mode()
&& self.params.batch_size > MAX_BATCH_SIZE_FOR_BLOCK_VALIDATION
{
return Err(format!("Batch size is too large. This may cause problems with runtime memory allocation. Better set `--batch-size {}` or less.", MAX_BATCH_SIZE_FOR_BLOCK_VALIDATION).into());
}