Skip to content

Commit b42eee4

Browse files
committed
Manually fix uninlined_format_args lint error
The `uninlined_format_args` lint was added in the latest Rust 1.88 nightly. This commit includes the manual changes required to address it. Specifically, the ones that `cargo clippy --fix` could not automatically resolve. [Clippy lint reference](https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args)
1 parent cafd68b commit b42eee4

File tree

6 files changed

+34
-35
lines changed

6 files changed

+34
-35
lines changed

payjoin-cli/src/app/config.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,7 @@ impl Config {
146146
Ok(v1) => config.version = Some(VersionConfig::V1(v1)),
147147
Err(e) =>
148148
return Err(ConfigError::Message(format!(
149-
"Valid V1 configuration is required for BIP78 mode: {}",
150-
e
149+
"Valid V1 configuration is required for BIP78 mode: {e}"
151150
))),
152151
}
153152
}

payjoin-cli/src/app/v1.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ impl AppTrait for App {
9191
);
9292
let psbt = ctx.process_response(&mut response.bytes().await?.to_vec().as_slice()).map_err(
9393
|e| {
94-
log::debug!("Error processing response: {:?}", e);
95-
anyhow!("Failed to process response {}", e)
94+
log::debug!("Error processing response: {e:?}");
95+
anyhow!("Failed to process response {e}")
9696
},
9797
)?;
9898

@@ -165,7 +165,7 @@ impl App {
165165
let stream = match tls_acceptor.accept(stream).await {
166166
Ok(tls_stream) => tls_stream,
167167
Err(e) => {
168-
log::error!("TLS accept error: {}", e);
168+
log::error!("TLS accept error: {e}");
169169
return;
170170
}
171171
};
@@ -211,19 +211,19 @@ impl App {
211211
self,
212212
req: Request<Incoming>,
213213
) -> Result<Response<BoxBody<Bytes, hyper::Error>>> {
214-
log::debug!("Received request: {:?}", req);
214+
log::debug!("Received request: {req:?}");
215215
let mut response = match (req.method(), req.uri().path()) {
216216
(&Method::GET, "/bip21") => {
217217
let query_string = req.uri().query().unwrap_or("");
218-
log::debug!("{:?}, {:?}", req.method(), query_string);
218+
log::debug!("{:?}, {query_string:?}", req.method());
219219
let query_params: HashMap<_, _> =
220220
url::form_urlencoded::parse(query_string.as_bytes()).into_owned().collect();
221221
let amount = query_params.get("amount").map(|amt| {
222222
Amount::from_btc(amt.parse().expect("Failed to parse amount")).unwrap()
223223
});
224224
self.handle_get_bip21(amount)
225225
.map_err(|e| {
226-
log::error!("Error handling request: {}", e);
226+
log::error!("Error handling request: {e}");
227227
Response::builder().status(500).body(full(e.to_string())).unwrap()
228228
})
229229
.unwrap_or_else(|err_resp| err_resp)
@@ -233,11 +233,11 @@ impl App {
233233
.await
234234
.map_err(|e| match e {
235235
V1(e) => {
236-
log::error!("Error handling request: {}", e);
236+
log::error!("Error handling request: {e}");
237237
Response::builder().status(400).body(full(e.to_string())).unwrap()
238238
}
239239
e => {
240-
log::error!("Error handling request: {}", e);
240+
log::error!("Error handling request: {e}");
241241
Response::builder().status(500).body(full(e.to_string())).unwrap()
242242
}
243243
})

payjoin-cli/tests/e2e.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ mod e2e {
4848
let receiver_rpchost = format!("http://{}/wallet/receiver", bitcoind.params.rpc_socket);
4949
let sender_rpchost = format!("http://{}/wallet/sender", bitcoind.params.rpc_socket);
5050
let cookie_file = &bitcoind.params.cookie_file;
51-
let pj_endpoint = format!("https://localhost:{}", port);
51+
let pj_endpoint = format!("https://localhost:{port}");
5252
let payjoin_cli = env!("CARGO_BIN_EXE_payjoin-cli");
5353

5454
let mut cli_receiver = Command::new(payjoin_cli)
@@ -82,7 +82,7 @@ mod e2e {
8282
{
8383
// Write to stdout regardless
8484
stdout
85-
.write_all(format!("{}\n", line).as_bytes())
85+
.write_all(format!("{line}\n").as_bytes())
8686
.await
8787
.expect("Failed to write to stdout");
8888

@@ -121,7 +121,7 @@ mod e2e {
121121
lines.next_line().await.expect("Failed to read line from stdout")
122122
{
123123
stdout
124-
.write_all(format!("{}\n", line).as_bytes())
124+
.write_all(format!("{line}\n").as_bytes())
125125
.await
126126
.expect("Failed to write to stdout");
127127
if line.contains("Payjoin sent") {
@@ -173,8 +173,8 @@ mod e2e {
173173
CleanupGuard { paths: vec![receiver_db_path.clone(), sender_db_path.clone()] };
174174

175175
let result = tokio::select! {
176-
res = services.take_ohttp_relay_handle() => Err(format!("Ohttp relay is long running: {:?}", res).into()),
177-
res = services.take_directory_handle() => Err(format!("Directory server is long running: {:?}", res).into()),
176+
res = services.take_ohttp_relay_handle() => Err(format!("Ohttp relay is long running: {res:?}").into()),
177+
res = services.take_directory_handle() => Err(format!("Directory server is long running: {res:?}").into()),
178178
res = send_receive_cli_async(&services, receiver_db_path.clone(), sender_db_path.clone()) => res,
179179
};
180180

@@ -357,7 +357,7 @@ mod e2e {
357357
{
358358
// Write all output to tests stdout
359359
stdout
360-
.write_all(format!("{}\n", line).as_bytes())
360+
.write_all(format!("{line}\n").as_bytes())
361361
.await
362362
.expect("Failed to write to stdout");
363363

@@ -375,7 +375,7 @@ mod e2e {
375375

376376
fn cleanup_temp_file(path: &std::path::Path) {
377377
if let Err(e) = std::fs::remove_dir_all(path) {
378-
eprintln!("Failed to remove {:?}: {}", path, e);
378+
eprintln!("Failed to remove {path:?}: {e}");
379379
}
380380
}
381381
}

payjoin/src/receive/multiparty/error.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ impl fmt::Display for MultipartyError {
2929
match &self.0 {
3030
InternalMultipartyError::NotEnoughProposals => write!(f, "Not enough proposals"),
3131
InternalMultipartyError::ProposalVersionNotSupported(v) =>
32-
write!(f, "Proposal version not supported: {}", v),
32+
write!(f, "Proposal version not supported: {v}"),
3333
InternalMultipartyError::OptimisticMergeNotSupported =>
3434
write!(f, "Optimistic merge not supported"),
3535
InternalMultipartyError::BitcoinExtractTxError(e) =>
36-
write!(f, "Bitcoin extract tx error: {:?}", e),
36+
write!(f, "Bitcoin extract tx error: {e:?}"),
3737
InternalMultipartyError::InputMissingWitnessOrScriptSig =>
3838
write!(f, "Input in Finalized Proposal is missing witness or script_sig"),
3939
InternalMultipartyError::FailedToCombinePsbts(e) =>
40-
write!(f, "Failed to combine psbts: {:?}", e),
40+
write!(f, "Failed to combine psbts: {e:?}"),
4141
}
4242
}
4343
}

payjoin/src/receive/v1/exclusive/error.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@ impl From<RequestError> for JsonReply {
5656
impl fmt::Display for RequestError {
5757
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
5858
match &self.0 {
59-
InternalRequestError::Io(e) => write!(f, "{}", e),
60-
InternalRequestError::MissingHeader(header) => write!(f, "Missing header: {}", header),
59+
InternalRequestError::Io(e) => write!(f, "{e}"),
60+
InternalRequestError::MissingHeader(header) => write!(f, "Missing header: {header}"),
6161
InternalRequestError::InvalidContentType(content_type) =>
62-
write!(f, "Invalid content type: {}", content_type),
63-
InternalRequestError::InvalidContentLength(e) => write!(f, "{}", e),
62+
write!(f, "Invalid content type: {content_type}"),
63+
InternalRequestError::InvalidContentLength(e) => write!(f, "{e}"),
6464
InternalRequestError::ContentLengthTooLarge(length) =>
65-
write!(f, "Content length too large: {}.", length),
65+
write!(f, "Content length too large: {length}."),
6666
}
6767
}
6868
}

payjoin/tests/integration.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ mod integration {
8585
.check_pj_supported()
8686
.map_err(|e| e.to_string())?;
8787
let psbt = build_original_psbt(&sender, &uri)?;
88-
debug!("Original psbt: {:#?}", psbt);
88+
debug!("Original psbt: {psbt:#?}");
8989
let (req, ctx) = SenderBuilder::new(psbt, uri)
9090
.build_with_additional_fee(Amount::from_sat(10000), None, FeeRate::ZERO, false)?
9191
.extract_v1();
@@ -150,7 +150,7 @@ mod integration {
150150
.check_pj_supported()
151151
.map_err(|e| e.to_string())?;
152152
let psbt = build_original_psbt(&sender, &uri)?;
153-
debug!("Original psbt: {:#?}", psbt);
153+
debug!("Original psbt: {psbt:#?}");
154154
let (req, _ctx) = SenderBuilder::new(psbt, uri)
155155
.build_with_additional_fee(Amount::from_sat(10000), None, FeeRate::ZERO, false)?
156156
.extract_v1();
@@ -656,14 +656,14 @@ mod integration {
656656
.map(input_pair_from_list_unspent);
657657
let selected_input =
658658
payjoin.try_preserving_privacy(candidate_inputs).map_err(|e| {
659-
format!("Failed to make privacy preserving selection: {:?}", e)
659+
format!("Failed to make privacy preserving selection: {e:?}")
660660
})?;
661661
vec![selected_input]
662662
}
663663
};
664664
let payjoin = payjoin
665665
.contribute_inputs(inputs)
666-
.map_err(|e| format!("Failed to contribute inputs: {:?}", e))?
666+
.map_err(|e| format!("Failed to contribute inputs: {e:?}"))?
667667
.commit_inputs();
668668

669669
// Sign and finalize the proposal PSBT
@@ -1038,7 +1038,7 @@ mod integration {
10381038
.check_pj_supported()
10391039
.map_err(|e| e.to_string())?;
10401040
let psbt = build_original_psbt(&sender, &uri)?;
1041-
log::debug!("Original psbt: {:#?}", psbt);
1041+
log::debug!("Original psbt: {psbt:#?}");
10421042
let max_additional_fee = Amount::from_sat(1000);
10431043
let (req, ctx) = SenderBuilder::new(psbt.clone(), uri)
10441044
.build_with_additional_fee(max_additional_fee, None, FeeRate::ZERO, false)?
@@ -1116,7 +1116,7 @@ mod integration {
11161116
.check_pj_supported()
11171117
.map_err(|e| e.to_string())?;
11181118
let psbt = build_original_psbt(&sender, &uri)?;
1119-
log::debug!("Original psbt: {:#?}", psbt);
1119+
log::debug!("Original psbt: {psbt:#?}");
11201120
let (req, ctx) = SenderBuilder::new(psbt.clone(), uri)
11211121
.build_with_additional_fee(Amount::from_sat(10000), None, FeeRate::ZERO, false)?
11221122
.extract_v1();
@@ -1226,7 +1226,7 @@ mod integration {
12261226
let proposal =
12271227
handle_proposal(proposal, receiver, custom_outputs, drain_script, custom_inputs)?;
12281228
let psbt = proposal.psbt();
1229-
tracing::debug!("Receiver's Payjoin proposal PSBT: {:#?}", &psbt);
1229+
tracing::debug!("Receiver's Payjoin proposal PSBT: {psbt:#?}");
12301230
Ok(psbt.to_string())
12311231
}
12321232

@@ -1284,13 +1284,13 @@ mod integration {
12841284
.map(input_pair_from_list_unspent);
12851285
let selected_input = payjoin
12861286
.try_preserving_privacy(candidate_inputs)
1287-
.map_err(|e| format!("Failed to make privacy preserving selection: {:?}", e))?;
1287+
.map_err(|e| format!("Failed to make privacy preserving selection: {e:?}"))?;
12881288
vec![selected_input]
12891289
}
12901290
};
12911291
let payjoin = payjoin
12921292
.contribute_inputs(inputs)
1293-
.map_err(|e| format!("Failed to contribute inputs: {:?}", e))?
1293+
.map_err(|e| format!("Failed to contribute inputs: {e:?}"))?
12941294
.commit_inputs();
12951295

12961296
let payjoin_proposal = payjoin.finalize_proposal(
@@ -1320,7 +1320,7 @@ mod integration {
13201320
let payjoin_psbt =
13211321
sender.finalize_psbt(&payjoin_psbt, Some(false))?.psbt.expect("should contain a PSBT");
13221322
let payjoin_psbt = Psbt::from_str(&payjoin_psbt)?;
1323-
tracing::debug!("Sender's Payjoin PSBT: {:#?}", payjoin_psbt);
1323+
tracing::debug!("Sender's Payjoin PSBT: {payjoin_psbt:#?}");
13241324

13251325
Ok(payjoin_psbt.extract_tx()?)
13261326
}

0 commit comments

Comments
 (0)