Skip to content

Commit 7a52331

Browse files
committed
chore(clippy): fix clippy warnings
1 parent 7a71b14 commit 7a52331

4 files changed

Lines changed: 15 additions & 16 deletions

File tree

src/handlers.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -355,9 +355,9 @@ pub(crate) async fn handle_online_wallet_subcommand(
355355
let mut once = HashSet::<KeychainKind>::new();
356356
move |k, spk_i, _| {
357357
if once.insert(k) {
358-
print!("\nScanning keychain [{:?}]", k);
358+
print!("\nScanning keychain [{k:?}]");
359359
}
360-
print!(" {:<3}", spk_i);
360+
print!(" {spk_i:<3}");
361361
stdout.flush().expect("must flush");
362362
}
363363
});
@@ -432,7 +432,7 @@ pub(crate) async fn handle_online_wallet_subcommand(
432432
.start_sync_with_revealed_spks()
433433
.inspect(|item, progress| {
434434
let pc = (100 * progress.consumed()) as f32 / progress.total() as f32;
435-
eprintln!("[ SCANNING {:03.0}% ] {}", pc, item);
435+
eprintln!("[ SCANNING {pc:03.0}% ] {item}");
436436
});
437437
match client {
438438
#[cfg(feature = "electrum")]
@@ -558,7 +558,7 @@ pub(crate) async fn handle_online_wallet_subcommand(
558558

559559
let subscriber = tracing_subscriber::FmtSubscriber::new();
560560
tracing::subscriber::set_global_default(subscriber)
561-
.map_err(|e| Error::Generic(format!("SetGlobalDefault error: {}", e)))?;
561+
.map_err(|e| Error::Generic(format!("SetGlobalDefault error: {e}")))?;
562562

563563
tokio::task::spawn(async move { node.run().await });
564564
tokio::task::spawn(async move {
@@ -578,7 +578,7 @@ pub(crate) async fn handle_online_wallet_subcommand(
578578
let txid = tx.compute_txid();
579579
requester
580580
.broadcast_random(tx.clone())
581-
.map_err(|e| Error::Generic(format!("{}", e)))?;
581+
.map_err(|e| Error::Generic(format!("{e}")))?;
582582
tokio::time::timeout(tokio::time::Duration::from_secs(30), async move {
583583
while let Some(info) = info_subscriber.recv().await {
584584
match info {
@@ -619,8 +619,7 @@ pub(crate) fn is_final(psbt: &Psbt) -> Result<(), Error> {
619619
let psbt_inputs = psbt.inputs.len();
620620
if unsigned_tx_inputs != psbt_inputs {
621621
return Err(Error::Generic(format!(
622-
"Malformed PSBT, {} unsigned tx inputs and {} psbt inputs.",
623-
unsigned_tx_inputs, psbt_inputs
622+
"Malformed PSBT, {unsigned_tx_inputs} unsigned tx inputs and {psbt_inputs} psbt inputs."
624623
)));
625624
}
626625
let sig_count = psbt.inputs.iter().fold(0, |count, input| {
@@ -948,7 +947,7 @@ async fn respond(
948947
};
949948
if let Some(value) = response {
950949
let value = serde_json::to_string_pretty(&value).map_err(|e| e.to_string())?;
951-
writeln!(std::io::stdout(), "{}", value).map_err(|e| e.to_string())?;
950+
writeln!(std::io::stdout(), "{value}").map_err(|e| e.to_string())?;
952951
std::io::stdout().flush().map_err(|e| e.to_string())?;
953952
Ok(false)
954953
} else {

src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ async fn main() {
2828
let cli_opts: CliOpts = CliOpts::parse();
2929

3030
let network = &cli_opts.network;
31-
debug!("network: {:?}", network);
31+
debug!("network: {network:?}");
3232
if network == &Network::Bitcoin {
3333
warn!("This is experimental software and not currently recommended for use on Bitcoin mainnet, proceed with caution.")
3434
}
3535

3636
match handle_command(cli_opts).await {
37-
Ok(result) => println!("{}", result),
37+
Ok(result) => println!("{result}"),
3838
Err(e) => {
39-
error!("{}", e);
39+
error!("{e}");
4040
std::process::exit(1);
4141
}
4242
}

src/utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ pub async fn sync_kyoto_client(wallet: &mut Wallet, client: Box<LightClient>) ->
337337

338338
let subscriber = tracing_subscriber::FmtSubscriber::new();
339339
tracing::subscriber::set_global_default(subscriber)
340-
.map_err(|e| Error::Generic(format!("SetGlobalDefault error: {}", e)))?;
340+
.map_err(|e| Error::Generic(format!("SetGlobalDefault error: {e}")))?;
341341

342342
tokio::task::spawn(async move { node.run().await });
343343
tokio::task::spawn(async move {
@@ -354,7 +354,7 @@ pub async fn sync_kyoto_client(wallet: &mut Wallet, client: Box<LightClient>) ->
354354
tracing::info!("Received update: applying to wallet");
355355
wallet
356356
.apply_update(update)
357-
.map_err(|e| Error::Generic(format!("Failed to apply update: {}", e)))?;
357+
.map_err(|e| Error::Generic(format!("Failed to apply update: {e}")))?;
358358

359359
tracing::info!(
360360
"Chain tip: {}, Transactions: {}, Balance: {}",

tests/integration.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,19 +127,19 @@ mod test {
127127
node_datadir,
128128
};
129129

130-
println!("BDK-CLI Config : {:#?}", bdk_cli);
130+
println!("BDK-CLI Config : {bdk_cli:#?}");
131131
let bdk_master_key = bdk_cli.key_exec(&["generate"])?;
132132
let bdk_xprv = get_value(&bdk_master_key, "xprv")?;
133133

134134
let bdk_recv_desc =
135135
bdk_cli.key_exec(&["derive", "--path", "m/84h/1h/0h/0", "--xprv", &bdk_xprv])?;
136136
let bdk_recv_desc = get_value(&bdk_recv_desc, "xprv")?;
137-
let bdk_recv_desc = format!("wpkh({})", bdk_recv_desc);
137+
let bdk_recv_desc = format!("wpkh({bdk_recv_desc})");
138138

139139
let bdk_chng_desc =
140140
bdk_cli.key_exec(&["derive", "--path", "m/84h/1h/0h/1", "--xprv", &bdk_xprv])?;
141141
let bdk_chng_desc = get_value(&bdk_chng_desc, "xprv")?;
142-
let bdk_chng_desc = format!("wpkh({})", bdk_chng_desc);
142+
let bdk_chng_desc = format!("wpkh({bdk_chng_desc})");
143143

144144
bdk_cli.recv_desc = Some(bdk_recv_desc);
145145
bdk_cli.chang_desc = Some(bdk_chng_desc);

0 commit comments

Comments
 (0)