mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 04:01:02 +00:00
fixes for nightly clippy (#1618)
This commit is contained in:
committed by
Bastian Köcher
parent
9592b55fea
commit
f58e076ca2
@@ -79,7 +79,7 @@ impl std::str::FromStr for ConversionRateOverride {
|
||||
|
||||
f64::from_str(s)
|
||||
.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?;
|
||||
|
||||
log::info!(target: "bridge", "Fee: {:?}", Balance(fee.into()));
|
||||
println!("{}", fee);
|
||||
println!("{fee}");
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ impl std::str::FromStr for HexBytes {
|
||||
|
||||
impl std::fmt::Debug for HexBytes {
|
||||
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)
|
||||
.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() {
|
||||
// given
|
||||
let hex = HexBytes(vec![1, 2, 3, 4]);
|
||||
let display = format!("{}", hex);
|
||||
let display = format!("{hex}");
|
||||
|
||||
// when
|
||||
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,
|
||||
target_priority: TransactionPriority,
|
||||
) -> 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 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;
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ pub enum Error {
|
||||
|
||||
impl From<tokio::task::JoinError> for Error {
|
||||
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
|
||||
.best_finalized_source_block_id()
|
||||
.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| {
|
||||
if self.submitted_header_number > best_id_at_target.0 {
|
||||
return Err(format!(
|
||||
|
||||
@@ -39,15 +39,15 @@ impl SyncLoopMetrics {
|
||||
) -> Result<Self, PrometheusError> {
|
||||
Ok(SyncLoopMetrics {
|
||||
best_source_block_number: IntGauge::new(
|
||||
metric_name(prefix, &format!("best_{}_block_number", at_source_chain_label)),
|
||||
format!("Best block number at the {}", 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}"),
|
||||
)?,
|
||||
best_target_block_number: IntGauge::new(
|
||||
metric_name(prefix, &format!("best_{}_block_number", at_target_chain_label)),
|
||||
format!("Best block number at the {}", 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}"),
|
||||
)?,
|
||||
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 \
|
||||
corresponding block at the source node",
|
||||
)?,
|
||||
|
||||
@@ -168,7 +168,7 @@ impl<P: SubstrateFinalitySyncPipeline> SourceClient<FinalitySyncPipelineAdapter<
|
||||
let justification = match decoded_justification {
|
||||
Ok(j) => j,
|
||||
Err(err) => {
|
||||
log_error(format!("decode failed with error {:?}", err));
|
||||
log_error(format!("decode failed with error {err:?}"));
|
||||
continue
|
||||
},
|
||||
};
|
||||
|
||||
@@ -21,8 +21,8 @@ use relay_utils::metrics::{FloatJsonValueMetric, PrometheusError, StandaloneMetr
|
||||
/// Creates standalone token price metric.
|
||||
pub fn token_price_metric(token_id: &str) -> Result<FloatJsonValueMetric, PrometheusError> {
|
||||
FloatJsonValueMetric::new(
|
||||
format!("https://api.coingecko.com/api/v3/simple/price?ids={}&vs_currencies=btc", token_id),
|
||||
format!("$.{}.btc", token_id),
|
||||
format!("https://api.coingecko.com/api/v3/simple/price?ids={token_id}&vs_currencies=btc"),
|
||||
format!("$.{token_id}.btc"),
|
||||
format!("{}_to_base_conversion_rate", token_id.replace('-', "_")),
|
||||
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.
|
||||
pub fn tag(&self) -> String {
|
||||
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, .. } => {
|
||||
format!("{}Parachains", bridged_chain)
|
||||
format!("{bridged_chain}Parachains")
|
||||
},
|
||||
TaggedAccount::Messages { ref bridged_chain, .. } => {
|
||||
format!("{}Messages", bridged_chain)
|
||||
format!("{bridged_chain}Messages")
|
||||
},
|
||||
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
|
||||
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 =
|
||||
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 mandatory_scan_range = mandatory_headers_scan_range::<P::SourceChain>(
|
||||
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.
|
||||
race_target.nonces(at_block, false)
|
||||
.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)| {
|
||||
if nonces_at_target.latest_nonce < *nonces_submitted.end() {
|
||||
Err(format!(
|
||||
|
||||
@@ -68,7 +68,7 @@ pub fn initialize_logger(with_timestamp: bool) {
|
||||
let log_level = color_level(record.level());
|
||||
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() {
|
||||
String::new()
|
||||
} else {
|
||||
format!("[{}] ", loop_name)
|
||||
format!("[{loop_name}] ")
|
||||
}
|
||||
})
|
||||
.unwrap_or_else(|_| String::new())
|
||||
@@ -105,8 +105,8 @@ enum Either<A, B> {
|
||||
impl<A: Display, B: Display> Display for Either<A, B> {
|
||||
fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
match self {
|
||||
Self::Left(a) => write!(fmt, "{}", a),
|
||||
Self::Right(b) => write!(fmt, "{}", b),
|
||||
Self::Left(a) => write!(fmt, "{a}"),
|
||||
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 => {
|
||||
let id0 = ids.next().expect(NTH_PROOF);
|
||||
let id1 = ids.next().expect(NTH_PROOF);
|
||||
format!("[{:?}, {:?}]", id0, id1)
|
||||
format!("[{id0:?}, {id1:?}]")
|
||||
},
|
||||
len => {
|
||||
let id0 = ids.next().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.
|
||||
pub fn metric_name(prefix: Option<&str>, name: &str) -> String {
|
||||
if let Some(prefix) = prefix {
|
||||
format!("{}_{}", prefix, name)
|
||||
format!("{prefix}_{name}")
|
||||
} else {
|
||||
name.into()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user