mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 08:41:07 +00:00
fixes for nightly clippy (#1618)
This commit is contained in:
committed by
Bastian Köcher
parent
9592b55fea
commit
f58e076ca2
@@ -56,7 +56,7 @@ pub enum Alternative {
|
|||||||
|
|
||||||
/// Helper function to generate a crypto pair from seed
|
/// Helper function to generate a crypto pair from seed
|
||||||
pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
|
pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
|
||||||
TPublic::Pair::from_string(&format!("//{}", seed), None)
|
TPublic::Pair::from_string(&format!("//{seed}"), None)
|
||||||
.expect("static values are valid; qed")
|
.expect("static values are valid; qed")
|
||||||
.public()
|
.public()
|
||||||
}
|
}
|
||||||
@@ -150,7 +150,7 @@ fn endowed_accounts() -> Vec<AccountId> {
|
|||||||
let all_authorities = ALL_AUTHORITIES_ACCOUNTS.iter().flat_map(|x| {
|
let all_authorities = ALL_AUTHORITIES_ACCOUNTS.iter().flat_map(|x| {
|
||||||
[
|
[
|
||||||
get_account_id_from_seed::<sr25519::Public>(x),
|
get_account_id_from_seed::<sr25519::Public>(x),
|
||||||
get_account_id_from_seed::<sr25519::Public>(&format!("{}//stash", x)),
|
get_account_id_from_seed::<sr25519::Public>(&format!("{x}//stash")),
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
vec![
|
vec![
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ impl SubstrateCli for Cli {
|
|||||||
match id {
|
match id {
|
||||||
"" | "dev" => crate::chain_spec::Alternative::Development,
|
"" | "dev" => crate::chain_spec::Alternative::Development,
|
||||||
"local" => crate::chain_spec::Alternative::LocalTestnet,
|
"local" => crate::chain_spec::Alternative::LocalTestnet,
|
||||||
_ => return Err(format!("Unsupported chain specification: {}", id)),
|
_ => return Err(format!("Unsupported chain specification: {id}")),
|
||||||
}
|
}
|
||||||
.load(),
|
.load(),
|
||||||
))
|
))
|
||||||
|
|||||||
@@ -293,7 +293,7 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
|
|||||||
|
|
||||||
Box::new(move |_, subscription_executor: sc_rpc::SubscriptionTaskExecutor| {
|
Box::new(move |_, subscription_executor: sc_rpc::SubscriptionTaskExecutor| {
|
||||||
let mut io = RpcModule::new(());
|
let mut io = RpcModule::new(());
|
||||||
let map_err = |e| sc_service::Error::Other(format!("{}", e));
|
let map_err = |e| sc_service::Error::Other(format!("{e}"));
|
||||||
io.merge(System::new(client.clone(), pool.clone(), DenyUnsafe::No).into_rpc())
|
io.merge(System::new(client.clone(), pool.clone(), DenyUnsafe::No).into_rpc())
|
||||||
.map_err(map_err)?;
|
.map_err(map_err)?;
|
||||||
io.merge(TransactionPayment::new(client.clone()).into_rpc()).map_err(map_err)?;
|
io.merge(TransactionPayment::new(client.clone()).into_rpc()).map_err(map_err)?;
|
||||||
@@ -314,7 +314,7 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
|
|||||||
beefy_rpc_links.from_voter_best_beefy_stream.clone(),
|
beefy_rpc_links.from_voter_best_beefy_stream.clone(),
|
||||||
subscription_executor,
|
subscription_executor,
|
||||||
)
|
)
|
||||||
.map_err(|e| sc_service::Error::Other(format!("{}", e)))?
|
.map_err(|e| sc_service::Error::Other(format!("{e}")))?
|
||||||
.into_rpc(),
|
.into_rpc(),
|
||||||
)
|
)
|
||||||
.map_err(map_err)?;
|
.map_err(map_err)?;
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ pub type ChainSpec =
|
|||||||
|
|
||||||
/// Helper function to generate a crypto pair from seed
|
/// Helper function to generate a crypto pair from seed
|
||||||
pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
|
pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
|
||||||
TPublic::Pair::from_string(&format!("//{}", seed), None)
|
TPublic::Pair::from_string(&format!("//{seed}"), None)
|
||||||
.expect("static values are valid; qed")
|
.expect("static values are valid; qed")
|
||||||
.public()
|
.public()
|
||||||
}
|
}
|
||||||
@@ -81,7 +81,7 @@ fn endowed_accounts() -> Vec<AccountId> {
|
|||||||
let all_authorities = ALL_AUTHORITIES_ACCOUNTS.iter().flat_map(|x| {
|
let all_authorities = ALL_AUTHORITIES_ACCOUNTS.iter().flat_map(|x| {
|
||||||
[
|
[
|
||||||
get_account_id_from_seed::<sr25519::Public>(x),
|
get_account_id_from_seed::<sr25519::Public>(x),
|
||||||
get_account_id_from_seed::<sr25519::Public>(&format!("{}//stash", x)),
|
get_account_id_from_seed::<sr25519::Public>(&format!("{x}//stash")),
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
vec![
|
vec![
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ pub fn run() -> Result<()> {
|
|||||||
&polkadot_cli,
|
&polkadot_cli,
|
||||||
config.tokio_handle.clone(),
|
config.tokio_handle.clone(),
|
||||||
)
|
)
|
||||||
.map_err(|err| format!("Relay chain argument error: {}", err))?;
|
.map_err(|err| format!("Relay chain argument error: {err}"))?;
|
||||||
|
|
||||||
cmd.run(config, polkadot_config)
|
cmd.run(config, polkadot_config)
|
||||||
})
|
})
|
||||||
@@ -292,7 +292,7 @@ pub fn run() -> Result<()> {
|
|||||||
let state_version =
|
let state_version =
|
||||||
RelayChainCli::native_runtime_version(&config.chain_spec).state_version();
|
RelayChainCli::native_runtime_version(&config.chain_spec).state_version();
|
||||||
let block: Block = generate_genesis_block(&*config.chain_spec, state_version)
|
let block: Block = generate_genesis_block(&*config.chain_spec, state_version)
|
||||||
.map_err(|e| format!("{:?}", e))?;
|
.map_err(|e| format!("{e:?}"))?;
|
||||||
let genesis_state = format!("0x{:?}", HexDisplay::from(&block.header().encode()));
|
let genesis_state = format!("0x{:?}", HexDisplay::from(&block.header().encode()));
|
||||||
|
|
||||||
let polkadot_config = SubstrateCli::create_configuration(
|
let polkadot_config = SubstrateCli::create_configuration(
|
||||||
@@ -300,7 +300,7 @@ pub fn run() -> Result<()> {
|
|||||||
&polkadot_cli,
|
&polkadot_cli,
|
||||||
config.tokio_handle.clone(),
|
config.tokio_handle.clone(),
|
||||||
)
|
)
|
||||||
.map_err(|err| format!("Relay chain argument error: {}", err))?;
|
.map_err(|err| format!("Relay chain argument error: {err}"))?;
|
||||||
|
|
||||||
info!("Parachain id: {:?}", id);
|
info!("Parachain id: {:?}", id);
|
||||||
info!("Parachain Account: {}", parachain_account);
|
info!("Parachain Account: {}", parachain_account);
|
||||||
|
|||||||
@@ -443,7 +443,7 @@ pub async fn start_node(
|
|||||||
use substrate_frame_rpc_system::{System, SystemApiServer};
|
use substrate_frame_rpc_system::{System, SystemApiServer};
|
||||||
|
|
||||||
let mut io = jsonrpsee::RpcModule::new(());
|
let mut io = jsonrpsee::RpcModule::new(());
|
||||||
let map_err = |e| sc_service::Error::Other(format!("{}", e));
|
let map_err = |e| sc_service::Error::Other(format!("{e}"));
|
||||||
io.merge(System::new(client.clone(), pool, DenyUnsafe::No).into_rpc())
|
io.merge(System::new(client.clone(), pool, DenyUnsafe::No).into_rpc())
|
||||||
.map_err(map_err)?;
|
.map_err(map_err)?;
|
||||||
io.merge(TransactionPayment::new(client).into_rpc()).map_err(map_err)?;
|
io.merge(TransactionPayment::new(client).into_rpc()).map_err(map_err)?;
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ pub enum Alternative {
|
|||||||
|
|
||||||
/// Helper function to generate a crypto pair from seed
|
/// Helper function to generate a crypto pair from seed
|
||||||
pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
|
pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
|
||||||
TPublic::Pair::from_string(&format!("//{}", seed), None)
|
TPublic::Pair::from_string(&format!("//{seed}"), None)
|
||||||
.expect("static values are valid; qed")
|
.expect("static values are valid; qed")
|
||||||
.public()
|
.public()
|
||||||
}
|
}
|
||||||
@@ -156,7 +156,7 @@ fn endowed_accounts() -> Vec<AccountId> {
|
|||||||
let all_authorities = ALL_AUTHORITIES_ACCOUNTS.iter().flat_map(|x| {
|
let all_authorities = ALL_AUTHORITIES_ACCOUNTS.iter().flat_map(|x| {
|
||||||
[
|
[
|
||||||
get_account_id_from_seed::<sr25519::Public>(x),
|
get_account_id_from_seed::<sr25519::Public>(x),
|
||||||
get_account_id_from_seed::<sr25519::Public>(&format!("{}//stash", x)),
|
get_account_id_from_seed::<sr25519::Public>(&format!("{x}//stash")),
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
vec![
|
vec![
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ impl SubstrateCli for Cli {
|
|||||||
match id {
|
match id {
|
||||||
"" | "dev" => crate::chain_spec::Alternative::Development,
|
"" | "dev" => crate::chain_spec::Alternative::Development,
|
||||||
"local" => crate::chain_spec::Alternative::LocalTestnet,
|
"local" => crate::chain_spec::Alternative::LocalTestnet,
|
||||||
_ => return Err(format!("Unsupported chain specification: {}", id)),
|
_ => return Err(format!("Unsupported chain specification: {id}")),
|
||||||
}
|
}
|
||||||
.load(),
|
.load(),
|
||||||
))
|
))
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ impl std::str::FromStr for ConversionRateOverride {
|
|||||||
|
|
||||||
f64::from_str(s)
|
f64::from_str(s)
|
||||||
.map(ConversionRateOverride::Explicit)
|
.map(ConversionRateOverride::Explicit)
|
||||||
.map_err(|e| format!("Failed to parse '{:?}'. Expected 'metric' or explicit value", e))
|
.map_err(|e| format!("Failed to parse '{e:?}'. Expected 'metric' or explicit value"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,7 +105,7 @@ where
|
|||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
log::info!(target: "bridge", "Fee: {:?}", Balance(fee.into()));
|
log::info!(target: "bridge", "Fee: {:?}", Balance(fee.into()));
|
||||||
println!("{}", fee);
|
println!("{fee}");
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -215,7 +215,7 @@ impl std::str::FromStr for HexBytes {
|
|||||||
|
|
||||||
impl std::fmt::Debug for HexBytes {
|
impl std::fmt::Debug for HexBytes {
|
||||||
fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result {
|
fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||||
write!(fmt, "0x{}", self)
|
write!(fmt, "0x{self}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -275,7 +275,7 @@ where
|
|||||||
|
|
||||||
V::from_str(s)
|
V::from_str(s)
|
||||||
.map(ExplicitOrMaximal::Explicit)
|
.map(ExplicitOrMaximal::Explicit)
|
||||||
.map_err(|e| format!("Failed to parse '{:?}'. Expected 'max' or explicit value", e))
|
.map_err(|e| format!("Failed to parse '{e:?}'. Expected 'max' or explicit value"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -298,7 +298,7 @@ mod tests {
|
|||||||
fn hex_bytes_display_matches_from_str_for_clap() {
|
fn hex_bytes_display_matches_from_str_for_clap() {
|
||||||
// given
|
// given
|
||||||
let hex = HexBytes(vec![1, 2, 3, 4]);
|
let hex = HexBytes(vec![1, 2, 3, 4]);
|
||||||
let display = format!("{}", hex);
|
let display = format!("{hex}");
|
||||||
|
|
||||||
// when
|
// when
|
||||||
let hex2: HexBytes = display.parse().unwrap();
|
let hex2: HexBytes = display.parse().unwrap();
|
||||||
|
|||||||
@@ -398,10 +398,10 @@ async fn update_transaction_tip<C: Chain, S: TransactionSignScheme<Chain = C>>(
|
|||||||
tip_limit: C::Balance,
|
tip_limit: C::Balance,
|
||||||
target_priority: TransactionPriority,
|
target_priority: TransactionPriority,
|
||||||
) -> Result<(bool, S::SignedTransaction), SubstrateError> {
|
) -> Result<(bool, S::SignedTransaction), SubstrateError> {
|
||||||
let stx = format!("{:?}", tx);
|
let stx = format!("{tx:?}");
|
||||||
let mut current_priority = client.validate_transaction(at_block.1, tx.clone()).await??.priority;
|
let mut current_priority = client.validate_transaction(at_block.1, tx.clone()).await??.priority;
|
||||||
let mut unsigned_tx = S::parse_transaction(tx).ok_or_else(|| {
|
let mut unsigned_tx = S::parse_transaction(tx).ok_or_else(|| {
|
||||||
SubstrateError::Custom(format!("Failed to parse {} transaction {}", C::NAME, stx,))
|
SubstrateError::Custom(format!("Failed to parse {} transaction {stx}", C::NAME,))
|
||||||
})?;
|
})?;
|
||||||
let old_tip = unsigned_tx.tip;
|
let old_tip = unsigned_tx.tip;
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ pub enum Error {
|
|||||||
|
|
||||||
impl From<tokio::task::JoinError> for Error {
|
impl From<tokio::task::JoinError> for Error {
|
||||||
fn from(error: tokio::task::JoinError) -> Self {
|
fn from(error: tokio::task::JoinError) -> Self {
|
||||||
Error::Custom(format!("Failed to wait tokio task: {}", error))
|
Error::Custom(format!("Failed to wait tokio task: {error}"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ impl<Tracker: TransactionTracker, Number: Debug + PartialOrd> Transaction<Tracke
|
|||||||
target_client
|
target_client
|
||||||
.best_finalized_source_block_id()
|
.best_finalized_source_block_id()
|
||||||
.await
|
.await
|
||||||
.map_err(|e| format!("failed to read best block from target node: {:?}", e))
|
.map_err(|e| format!("failed to read best block from target node: {e:?}"))
|
||||||
.and_then(|best_id_at_target| {
|
.and_then(|best_id_at_target| {
|
||||||
if self.submitted_header_number > best_id_at_target.0 {
|
if self.submitted_header_number > best_id_at_target.0 {
|
||||||
return Err(format!(
|
return Err(format!(
|
||||||
|
|||||||
@@ -39,15 +39,15 @@ impl SyncLoopMetrics {
|
|||||||
) -> Result<Self, PrometheusError> {
|
) -> Result<Self, PrometheusError> {
|
||||||
Ok(SyncLoopMetrics {
|
Ok(SyncLoopMetrics {
|
||||||
best_source_block_number: IntGauge::new(
|
best_source_block_number: IntGauge::new(
|
||||||
metric_name(prefix, &format!("best_{}_block_number", at_source_chain_label)),
|
metric_name(prefix, &format!("best_{at_source_chain_label}_block_number")),
|
||||||
format!("Best block number at the {}", at_source_chain_label),
|
format!("Best block number at the {at_source_chain_label}"),
|
||||||
)?,
|
)?,
|
||||||
best_target_block_number: IntGauge::new(
|
best_target_block_number: IntGauge::new(
|
||||||
metric_name(prefix, &format!("best_{}_block_number", at_target_chain_label)),
|
metric_name(prefix, &format!("best_{at_target_chain_label}_block_number")),
|
||||||
format!("Best block number at the {}", at_target_chain_label),
|
format!("Best block number at the {at_target_chain_label}"),
|
||||||
)?,
|
)?,
|
||||||
using_different_forks: IntGauge::new(
|
using_different_forks: IntGauge::new(
|
||||||
metric_name(prefix, &format!("is_{}_and_{}_using_different_forks", at_source_chain_label, at_target_chain_label)),
|
metric_name(prefix, &format!("is_{at_source_chain_label}_and_{at_target_chain_label}_using_different_forks")),
|
||||||
"Whether the best finalized source block at target node is different (value 1) from the \
|
"Whether the best finalized source block at target node is different (value 1) from the \
|
||||||
corresponding block at the source node",
|
corresponding block at the source node",
|
||||||
)?,
|
)?,
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ impl<P: SubstrateFinalitySyncPipeline> SourceClient<FinalitySyncPipelineAdapter<
|
|||||||
let justification = match decoded_justification {
|
let justification = match decoded_justification {
|
||||||
Ok(j) => j,
|
Ok(j) => j,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
log_error(format!("decode failed with error {:?}", err));
|
log_error(format!("decode failed with error {err:?}"));
|
||||||
continue
|
continue
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ use relay_utils::metrics::{FloatJsonValueMetric, PrometheusError, StandaloneMetr
|
|||||||
/// Creates standalone token price metric.
|
/// Creates standalone token price metric.
|
||||||
pub fn token_price_metric(token_id: &str) -> Result<FloatJsonValueMetric, PrometheusError> {
|
pub fn token_price_metric(token_id: &str) -> Result<FloatJsonValueMetric, PrometheusError> {
|
||||||
FloatJsonValueMetric::new(
|
FloatJsonValueMetric::new(
|
||||||
format!("https://api.coingecko.com/api/v3/simple/price?ids={}&vs_currencies=btc", token_id),
|
format!("https://api.coingecko.com/api/v3/simple/price?ids={token_id}&vs_currencies=btc"),
|
||||||
format!("$.{}.btc", token_id),
|
format!("$.{token_id}.btc"),
|
||||||
format!("{}_to_base_conversion_rate", token_id.replace('-', "_")),
|
format!("{}_to_base_conversion_rate", token_id.replace('-', "_")),
|
||||||
format!("Rate used to convert from {} to some BASE tokens", token_id.to_uppercase()),
|
format!("Rate used to convert from {} to some BASE tokens", token_id.to_uppercase()),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -85,15 +85,15 @@ impl<AccountId> TaggedAccount<AccountId> {
|
|||||||
/// Returns stringified account tag.
|
/// Returns stringified account tag.
|
||||||
pub fn tag(&self) -> String {
|
pub fn tag(&self) -> String {
|
||||||
match *self {
|
match *self {
|
||||||
TaggedAccount::Headers { ref bridged_chain, .. } => format!("{}Headers", bridged_chain),
|
TaggedAccount::Headers { ref bridged_chain, .. } => format!("{bridged_chain}Headers"),
|
||||||
TaggedAccount::Parachains { ref bridged_chain, .. } => {
|
TaggedAccount::Parachains { ref bridged_chain, .. } => {
|
||||||
format!("{}Parachains", bridged_chain)
|
format!("{bridged_chain}Parachains")
|
||||||
},
|
},
|
||||||
TaggedAccount::Messages { ref bridged_chain, .. } => {
|
TaggedAccount::Messages { ref bridged_chain, .. } => {
|
||||||
format!("{}Messages", bridged_chain)
|
format!("{bridged_chain}Messages")
|
||||||
},
|
},
|
||||||
TaggedAccount::MessagesPalletOwner { ref bridged_chain, .. } => {
|
TaggedAccount::MessagesPalletOwner { ref bridged_chain, .. } => {
|
||||||
format!("{}MessagesPalletOwner", bridged_chain)
|
format!("{bridged_chain}MessagesPalletOwner")
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -172,9 +172,9 @@ async fn background_task<P: SubstrateFinalitySyncPipeline>(
|
|||||||
|
|
||||||
// submit mandatory header if some headers are missing
|
// submit mandatory header if some headers are missing
|
||||||
let best_finalized_source_header_at_source_fmt =
|
let best_finalized_source_header_at_source_fmt =
|
||||||
format!("{:?}", best_finalized_source_header_at_source);
|
format!("{best_finalized_source_header_at_source:?}");
|
||||||
let best_finalized_source_header_at_target_fmt =
|
let best_finalized_source_header_at_target_fmt =
|
||||||
format!("{:?}", best_finalized_source_header_at_target);
|
format!("{best_finalized_source_header_at_target:?}");
|
||||||
let required_header_number_value = *required_header_number.lock().await;
|
let required_header_number_value = *required_header_number.lock().await;
|
||||||
let mandatory_scan_range = mandatory_headers_scan_range::<P::SourceChain>(
|
let mandatory_scan_range = mandatory_headers_scan_range::<P::SourceChain>(
|
||||||
best_finalized_source_header_at_source.ok(),
|
best_finalized_source_header_at_source.ok(),
|
||||||
|
|||||||
@@ -425,7 +425,7 @@ pub async fn run<P: MessageRace, SC: SourceClient<P>, TC: TargetClient<P>>(
|
|||||||
// nonce at the target node.
|
// nonce at the target node.
|
||||||
race_target.nonces(at_block, false)
|
race_target.nonces(at_block, false)
|
||||||
.await
|
.await
|
||||||
.map_err(|e| format!("failed to read nonces from target node: {:?}", e))
|
.map_err(|e| format!("failed to read nonces from target node: {e:?}"))
|
||||||
.and_then(|(_, nonces_at_target)| {
|
.and_then(|(_, nonces_at_target)| {
|
||||||
if nonces_at_target.latest_nonce < *nonces_submitted.end() {
|
if nonces_at_target.latest_nonce < *nonces_submitted.end() {
|
||||||
Err(format!(
|
Err(format!(
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ pub fn initialize_logger(with_timestamp: bool) {
|
|||||||
let log_level = color_level(record.level());
|
let log_level = color_level(record.level());
|
||||||
let log_target = color_target(record.target());
|
let log_target = color_target(record.target());
|
||||||
|
|
||||||
writeln!(buf, "{}{} {} {}", loop_name_prefix(), log_level, log_target, record.args(),)
|
writeln!(buf, "{}{log_level} {log_target} {}", loop_name_prefix(), record.args(),)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,7 +92,7 @@ fn loop_name_prefix() -> String {
|
|||||||
if loop_name.is_empty() {
|
if loop_name.is_empty() {
|
||||||
String::new()
|
String::new()
|
||||||
} else {
|
} else {
|
||||||
format!("[{}] ", loop_name)
|
format!("[{loop_name}] ")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.unwrap_or_else(|_| String::new())
|
.unwrap_or_else(|_| String::new())
|
||||||
@@ -105,8 +105,8 @@ enum Either<A, B> {
|
|||||||
impl<A: Display, B: Display> Display for Either<A, B> {
|
impl<A: Display, B: Display> Display for Either<A, B> {
|
||||||
fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result {
|
fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
Self::Left(a) => write!(fmt, "{}", a),
|
Self::Left(a) => write!(fmt, "{a}"),
|
||||||
Self::Right(b) => write!(fmt, "{}", b),
|
Self::Right(b) => write!(fmt, "{b}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -189,12 +189,12 @@ pub fn format_ids<Id: std::fmt::Debug>(mut ids: impl ExactSizeIterator<Item = Id
|
|||||||
2 => {
|
2 => {
|
||||||
let id0 = ids.next().expect(NTH_PROOF);
|
let id0 = ids.next().expect(NTH_PROOF);
|
||||||
let id1 = ids.next().expect(NTH_PROOF);
|
let id1 = ids.next().expect(NTH_PROOF);
|
||||||
format!("[{:?}, {:?}]", id0, id1)
|
format!("[{id0:?}, {id1:?}]")
|
||||||
},
|
},
|
||||||
len => {
|
len => {
|
||||||
let id0 = ids.next().expect(NTH_PROOF);
|
let id0 = ids.next().expect(NTH_PROOF);
|
||||||
let id_last = ids.last().expect(NTH_PROOF);
|
let id_last = ids.last().expect(NTH_PROOF);
|
||||||
format!("{}:[{:?} ... {:?}]", len, id0, id_last)
|
format!("{len}:[{id0:?} ... {id_last:?}]")
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ impl From<Option<MetricsAddress>> for MetricsParams {
|
|||||||
/// Returns metric name optionally prefixed with given prefix.
|
/// Returns metric name optionally prefixed with given prefix.
|
||||||
pub fn metric_name(prefix: Option<&str>, name: &str) -> String {
|
pub fn metric_name(prefix: Option<&str>, name: &str) -> String {
|
||||||
if let Some(prefix) = prefix {
|
if let Some(prefix) = prefix {
|
||||||
format!("{}_{}", prefix, name)
|
format!("{prefix}_{name}")
|
||||||
} else {
|
} else {
|
||||||
name.into()
|
name.into()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user