mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 06:57:58 +00:00
Improve overall performance (#6699)
* Improve overall performance * Clean up code Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Remove needless :: Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Remove needless :: Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
@@ -158,7 +158,7 @@ pub trait CliConfiguration: Sized {
|
||||
fn database_cache_size(&self) -> Result<Option<usize>> {
|
||||
Ok(self.database_params()
|
||||
.map(|x| x.database_cache_size())
|
||||
.unwrap_or(Default::default()))
|
||||
.unwrap_or_default())
|
||||
}
|
||||
|
||||
/// Get the database backend variant.
|
||||
@@ -195,7 +195,7 @@ pub trait CliConfiguration: Sized {
|
||||
fn state_cache_size(&self) -> Result<usize> {
|
||||
Ok(self.import_params()
|
||||
.map(|x| x.state_cache_size())
|
||||
.unwrap_or(Default::default()))
|
||||
.unwrap_or_default())
|
||||
}
|
||||
|
||||
/// Get the state cache child ratio (if any).
|
||||
@@ -212,7 +212,7 @@ pub trait CliConfiguration: Sized {
|
||||
fn pruning(&self, unsafe_pruning: bool, role: &Role) -> Result<PruningMode> {
|
||||
self.pruning_params()
|
||||
.map(|x| x.pruning(unsafe_pruning, role))
|
||||
.unwrap_or(Ok(Default::default()))
|
||||
.unwrap_or_else(|| Ok(Default::default()))
|
||||
}
|
||||
|
||||
/// Get the chain ID (string).
|
||||
@@ -236,7 +236,7 @@ pub trait CliConfiguration: Sized {
|
||||
fn wasm_method(&self) -> Result<WasmExecutionMethod> {
|
||||
Ok(self.import_params()
|
||||
.map(|x| x.wasm_method())
|
||||
.unwrap_or(Default::default()))
|
||||
.unwrap_or_default())
|
||||
}
|
||||
|
||||
/// Get the execution strategies.
|
||||
@@ -251,7 +251,7 @@ pub trait CliConfiguration: Sized {
|
||||
Ok(self
|
||||
.import_params()
|
||||
.map(|x| x.execution_strategies(is_dev, is_validator))
|
||||
.unwrap_or(Default::default()))
|
||||
.unwrap_or_default())
|
||||
}
|
||||
|
||||
/// Get the RPC HTTP address (`None` if disabled).
|
||||
@@ -365,7 +365,7 @@ pub trait CliConfiguration: Sized {
|
||||
fn tracing_targets(&self) -> Result<Option<String>> {
|
||||
Ok(self.import_params()
|
||||
.map(|x| x.tracing_targets())
|
||||
.unwrap_or(Default::default()))
|
||||
.unwrap_or_else(|| Default::default()))
|
||||
}
|
||||
|
||||
/// Get the TracingReceiver value from the current object
|
||||
@@ -375,7 +375,7 @@ pub trait CliConfiguration: Sized {
|
||||
fn tracing_receiver(&self) -> Result<TracingReceiver> {
|
||||
Ok(self.import_params()
|
||||
.map(|x| x.tracing_receiver())
|
||||
.unwrap_or(Default::default()))
|
||||
.unwrap_or_default())
|
||||
}
|
||||
|
||||
/// Get the node key from the current object
|
||||
@@ -385,7 +385,7 @@ pub trait CliConfiguration: Sized {
|
||||
fn node_key(&self, net_config_dir: &PathBuf) -> Result<NodeKeyConfig> {
|
||||
self.node_key_params()
|
||||
.map(|x| x.node_key(net_config_dir))
|
||||
.unwrap_or(Ok(Default::default()))
|
||||
.unwrap_or_else(|| Ok(Default::default()))
|
||||
}
|
||||
|
||||
/// Get maximum runtime instances
|
||||
|
||||
@@ -113,7 +113,7 @@ impl ImportParams {
|
||||
default
|
||||
};
|
||||
|
||||
exec.execution.unwrap_or(strat.unwrap_or(default)).into()
|
||||
exec.execution.unwrap_or_else(|| strat.unwrap_or(default)).into()
|
||||
};
|
||||
|
||||
let default_execution_import_block = if is_validator {
|
||||
|
||||
@@ -94,7 +94,7 @@ impl KeystoreParams {
|
||||
let path = self
|
||||
.keystore_path
|
||||
.clone()
|
||||
.unwrap_or(base_path.join(DEFAULT_KEYSTORE_CONFIG_PATH));
|
||||
.unwrap_or_else(|| base_path.join(DEFAULT_KEYSTORE_CONFIG_PATH));
|
||||
|
||||
Ok(KeystoreConfig::Path { path, password })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user