Skip to content

Commit 98cb6b9

Browse files
committed
docs(wallet): fix clippy warnings
1 parent f4f6dc8 commit 98cb6b9

File tree

4 files changed

+13
-23
lines changed
  • examples
    • example_wallet_electrum/src
    • example_wallet_esplora_async/src
    • example_wallet_esplora_blocking/src
    • example_wallet_rpc/src

4 files changed

+13
-23
lines changed

examples/example_wallet_electrum/src/main.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ fn main() -> Result<(), anyhow::Error> {
4040

4141
let address = wallet.next_unused_address(KeychainKind::External);
4242
wallet.persist(&mut db)?;
43-
println!("Generated Address: {}", address);
43+
println!("Generated Address: {address}");
4444

4545
let balance = wallet.balance();
4646
println!("Wallet balance before syncing: {}", balance.total());
@@ -57,9 +57,9 @@ fn main() -> Result<(), anyhow::Error> {
5757
let mut once = HashSet::<KeychainKind>::new();
5858
move |k, spk_i, _| {
5959
if once.insert(k) {
60-
print!("\nScanning keychain [{:?}]", k);
60+
print!("\nScanning keychain [{k:?}]");
6161
}
62-
print!(" {:<3}", spk_i);
62+
print!(" {spk_i:<3}");
6363
stdout.flush().expect("must flush");
6464
}
6565
});
@@ -81,8 +81,7 @@ fn main() -> Result<(), anyhow::Error> {
8181

8282
if balance.total() < SEND_AMOUNT {
8383
println!(
84-
"Please send at least {} to the receiving address",
85-
SEND_AMOUNT
84+
"Please send at least {SEND_AMOUNT} to the receiving address"
8685
);
8786
std::process::exit(0);
8887
}
@@ -116,7 +115,7 @@ fn main() -> Result<(), anyhow::Error> {
116115
(100 * sync_progress.consumed()) as f32 / sync_progress.total() as f32;
117116
let progress_percent = progress_percent.round() as u32;
118117
if progress_percent.is_multiple_of(5) && progress_percent > last_printed {
119-
print!("{}% ", progress_percent);
118+
print!("{progress_percent}% ");
120119
std::io::stdout().flush().expect("must flush");
121120
last_printed = progress_percent;
122121
}

examples/example_wallet_esplora_async/src/main.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ async fn main() -> Result<(), anyhow::Error> {
5252
let mut once = BTreeSet::<KeychainKind>::new();
5353
move |keychain, spk_i, _| {
5454
if once.insert(keychain) {
55-
print!("\nScanning keychain [{:?}]", keychain);
55+
print!("\nScanning keychain [{keychain:?}]");
5656
}
57-
print!(" {:<3}", spk_i);
57+
print!(" {spk_i:<3}");
5858
stdout.flush().expect("must flush")
5959
}
6060
});
@@ -76,10 +76,7 @@ async fn main() -> Result<(), anyhow::Error> {
7676
);
7777

7878
if balance.total() < SEND_AMOUNT {
79-
println!(
80-
"Please send at least {} to the receiving address",
81-
SEND_AMOUNT
82-
);
79+
println!("Please send at least {SEND_AMOUNT} to the receiving address");
8380
std::process::exit(0);
8481
}
8582

@@ -110,7 +107,7 @@ async fn main() -> Result<(), anyhow::Error> {
110107
(100 * sync_progress.consumed()) as f32 / sync_progress.total() as f32;
111108
let progress_percent = progress_percent.round() as u32;
112109
if progress_percent.is_multiple_of(5) && progress_percent > printed {
113-
print!("{}% ", progress_percent);
110+
print!("{progress_percent}% ");
114111
std::io::stdout().flush().expect("must flush");
115112
printed = progress_percent;
116113
}

examples/example_wallet_esplora_blocking/src/main.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ fn main() -> Result<(), anyhow::Error> {
5454
let mut once = BTreeSet::<KeychainKind>::new();
5555
move |keychain, spk_i, _| {
5656
if once.insert(keychain) {
57-
print!("\nScanning keychain [{:?}] ", keychain);
57+
print!("\nScanning keychain [{keychain:?}] ");
5858
}
59-
print!(" {:<3}", spk_i);
59+
print!(" {spk_i:<3}");
6060
stdout.flush().expect("must flush")
6161
}
6262
});
@@ -71,10 +71,7 @@ fn main() -> Result<(), anyhow::Error> {
7171
println!("Wallet balance after syncing: {}", balance.total());
7272

7373
if balance.total() < SEND_AMOUNT {
74-
println!(
75-
"Please send at least {} to the receiving address",
76-
SEND_AMOUNT
77-
);
74+
println!("Please send at least {SEND_AMOUNT} to the receiving address");
7875
std::process::exit(0);
7976
}
8077

examples/example_wallet_rpc/src/main.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,7 @@ fn main() -> anyhow::Result<()> {
166166
wallet.apply_block_connected_to(&block_emission.block, height, connected_to)?;
167167
wallet.persist(&mut db)?;
168168
let elapsed = start_apply_block.elapsed().as_secs_f32();
169-
println!(
170-
"Applied block {} at height {} in {}s",
171-
hash, height, elapsed
172-
);
169+
println!("Applied block {hash} at height {height} in {elapsed}s",);
173170
}
174171
Emission::Mempool(event) => {
175172
let start_apply_mempool = Instant::now();

0 commit comments

Comments
 (0)