Skip to content

Commit 5dfdc75

Browse files
authored
Merge pull request #315 from semiotic-ai/suchapalaver/clippy-fixes-for-rust-1.88
refactor(clippy): fix updated warnings for rust 1.88
2 parents 754cd77 + b69c15b commit 5dfdc75

File tree

7 files changed

+17
-18
lines changed

7 files changed

+17
-18
lines changed

tap_aggregator/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
fn main() -> Result<(), Box<dyn std::error::Error>> {
55
println!("Running build.rs...");
66
let out_dir = std::env::var("OUT_DIR").expect("OUT_DIR not set by Cargo");
7-
println!("OUT_DIR: {}", out_dir); // This should print the output directory
7+
println!("OUT_DIR: {out_dir}"); // This should print the output directory
88

99
tonic_build::configure().compile_protos(
1010
&[

tap_aggregator/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ async fn main() -> Result<()> {
8888
tracing_subscriber::fmt::init();
8989

9090
let args = Args::parse();
91-
debug!("Settings: {:?}", args);
91+
debug!("Settings: {args:?}");
9292

9393
// Start the metrics server.
9494
// We just let it gracelessly get killed at the end of main()

tap_aggregator/src/metrics.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ async fn handler_metrics() -> (StatusCode, String) {
2020
error!("Error encoding metrics: {}", e);
2121
(
2222
StatusCode::INTERNAL_SERVER_ERROR,
23-
format!("Error encoding metrics: {}", e),
23+
format!("Error encoding metrics: {e}"),
2424
)
2525
}
2626
}
@@ -41,14 +41,14 @@ async fn _run_server(port: u16) {
4141

4242
let server = serve(listener, app.into_make_service());
4343

44-
info!("Metrics server listening on {}", addr);
44+
info!("Metrics server listening on {addr}");
4545

4646
let res = server.await;
4747

4848
debug!("Metrics server stopped");
4949

5050
if let Err(err) = res {
51-
panic!("Metrics server error: {:#?}", err);
51+
panic!("Metrics server error: {err:#?}");
5252
};
5353
}
5454

tap_aggregator/src/server.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ fn parse_api_version(api_version: &str) -> Result<TapRpcApiVersion, JsonRpcError
110110
TapRpcApiVersion::from_str(api_version).map_err(|_| {
111111
jsonrpsee::types::ErrorObject::owned(
112112
JsonRpcErrorCode::InvalidVersion as i32,
113-
format!("Unsupported API version: \"{}\".", api_version),
113+
format!("Unsupported API version: \"{api_version}\"."),
114114
Some(tap_rpc_api_versions_info()),
115115
)
116116
})
@@ -123,9 +123,8 @@ fn check_api_version_deprecation(api_version: &TapRpcApiVersion) -> Option<JsonR
123123
Some(JsonRpcWarning::new(
124124
JsonRpcWarningCode::DeprecatedVersion as i32,
125125
format!(
126-
"The API version {} will be deprecated. \
127-
Please check https://github.com/semiotic-ai/timeline_aggregation_protocol for more information.",
128-
api_version
126+
"The API version {api_version} will be deprecated. \
127+
Please check https://github.com/semiotic-ai/timeline_aggregation_protocol for more information."
129128
),
130129
Some(tap_rpc_api_versions_info()),
131130
))
@@ -405,7 +404,7 @@ pub async fn run_server(
405404
);
406405

407406
// Create a `TcpListener` using tokio.
408-
let listener = TcpListener::bind(&format!("0.0.0.0:{}", port))
407+
let listener = TcpListener::bind(&format!("0.0.0.0:{port}"))
409408
.await
410409
.expect("Failed to bind to tap-aggregator port");
411410

tap_core/src/manager/tap_manager.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ impl<E, Rcpt> Manager<E, Rcpt> {
8585
if signed_rav.message != expected_rav {
8686
return Err(Error::InvalidReceivedRav {
8787
received_rav: format!("{:?}", signed_rav.message),
88-
expected_rav: format!("{:?}", expected_rav),
88+
expected_rav: format!("{expected_rav:?}"),
8989
});
9090
}
9191

tap_integration_tests/tests/indexer_mock.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,10 @@ where
166166
let server_config = ServerConfig::builder().http_only().build();
167167
let server = ServerBuilder::new()
168168
.set_config(server_config)
169-
.build(format!("127.0.0.1:{}", port))
169+
.build(format!("127.0.0.1:{port}"))
170170
.await?;
171171
let addr = server.local_addr()?;
172-
println!("Listening on: {}", addr);
172+
println!("Listening on: {addr}");
173173
let rpc_manager = RpcManager::new(
174174
domain_separator,
175175
context,
@@ -232,5 +232,5 @@ where
232232
}
233233

234234
fn to_rpc_error(e: Box<dyn std::error::Error>, msg: &str) -> jsonrpsee::types::ErrorObjectOwned {
235-
jsonrpsee::types::ErrorObject::owned(-32000, format!("{} - {}", e, msg), None::<()>)
235+
jsonrpsee::types::ErrorObject::owned(-32000, format!("{e} - {msg}"), None::<()>)
236236
}

tap_integration_tests/tests/showcase.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ async fn test_manager_one_indexer(
503503

504504
match result {
505505
Ok(()) => {}
506-
Err(e) => panic!("Error making receipt request: {:?}", e),
506+
Err(e) => panic!("Error making receipt request: {e:?}"),
507507
}
508508
}
509509

@@ -546,7 +546,7 @@ async fn test_manager_two_indexers(
546546
let future_2 = client_2.request("request", (receipt_2,));
547547
match tokio::try_join!(future_1, future_2) {
548548
Ok(((), ())) => {}
549-
Err(e) => panic!("Error making receipt request: {:?}", e),
549+
Err(e) => panic!("Error making receipt request: {e:?}"),
550550
}
551551
}
552552
Ok(())
@@ -681,7 +681,7 @@ async fn test_tap_manager_rav_timestamp_cuttoff(
681681
let result = client_2.request("request", (receipt_1,)).await;
682682
match result {
683683
Ok(()) => {}
684-
Err(e) => panic!("Error making receipt request: {:?}", e),
684+
Err(e) => panic!("Error making receipt request: {e:?}"),
685685
}
686686
}
687687
Ok(())
@@ -708,7 +708,7 @@ async fn test_tap_aggregator_rav_timestamp_cuttoff(
708708
http_max_concurrent_connections,
709709
)
710710
.await?;
711-
let client = HttpClientBuilder::default().build(format!("http://{}", sender_addr))?;
711+
let client = HttpClientBuilder::default().build(format!("http://{sender_addr}"))?;
712712

713713
// This is the first part of the test, two batches of receipts are sent to the aggregator.
714714
// The second batch has one receipt with the same timestamp as the latest receipt in the first batch.

0 commit comments

Comments
 (0)