From d2e3de258fbe1e2adac3043c09b7705fd82a366d Mon Sep 17 00:00:00 2001 From: Asmir Avdicevic Date: Thu, 26 Jun 2025 22:39:12 +0200 Subject: [PATCH] chore: update clippy --- examples/compute.rs | 10 +++++----- examples/derive.rs | 4 ++-- examples/storage.rs | 8 ++++---- irpc-derive/src/lib.rs | 4 ++-- irpc-iroh/examples/auth.rs | 4 ++-- irpc-iroh/examples/derive.rs | 8 ++++---- tests/mpsc_channel.rs | 2 +- tests/oneshot_channel.rs | 4 ++-- 8 files changed, 22 insertions(+), 22 deletions(-) diff --git a/examples/compute.rs b/examples/compute.rs index de00a38..84a6598 100644 --- a/examples/compute.rs +++ b/examples/compute.rs @@ -89,7 +89,7 @@ impl ComputeActor { while let Some(msg) = self.recv.recv().await { n0_future::task::spawn(async move { if let Err(cause) = Self::handle(msg).await { - eprintln!("Error: {}", cause); + eprintln!("Error: {cause}"); } }); } @@ -271,7 +271,7 @@ async fn local() -> anyhow::Result<()> { let mut rx = api.fibonacci(10).await?; print!("Local: Fibonacci up to 10 = "); while let Some(num) = rx.recv().await? { - print!("{} ", num); + print!("{num} "); } println!(); @@ -283,7 +283,7 @@ async fn local() -> anyhow::Result<()> { drop(in_tx); print!("Local: 3 * [2, 4, 6] = "); while let Some(num) = out_rx.recv().await? { - print!("{} ", num); + print!("{num} "); } println!(); @@ -322,7 +322,7 @@ async fn remote() -> anyhow::Result<()> { let mut rx = api.fibonacci(20).await?; print!("Remote: Fibonacci up to 20 = "); while let Some(num) = rx.recv().await? { - print!("{} ", num); + print!("{num} "); } println!(); @@ -334,7 +334,7 @@ async fn remote() -> anyhow::Result<()> { drop(in_tx); print!("Remote: 5 * [1, 2, 3] = "); while let Some(num) = out_rx.recv().await? { - print!("{} ", num); + print!("{num} "); } println!(); diff --git a/examples/derive.rs b/examples/derive.rs index 9d4324a..7928e10 100644 --- a/examples/derive.rs +++ b/examples/derive.rs @@ -170,7 +170,7 @@ impl StorageApi { async fn client_demo(api: StorageApi) -> Result<()> { api.set("hello".to_string(), "world".to_string()).await?; let value = api.get("hello".to_string()).await?; - println!("get: hello = {:?}", value); + println!("get: hello = {value:?}"); let (tx, rx) = api.set_many().await?; for i in 0..3 { @@ -182,7 +182,7 @@ async fn client_demo(api: StorageApi) -> Result<()> { let mut list = api.list().await?; while let Some(value) = list.recv().await? { - println!("list value = {:?}", value); + println!("list value = {value:?}"); } Ok(()) } diff --git a/examples/storage.rs b/examples/storage.rs index 0909494..cd721d5 100644 --- a/examples/storage.rs +++ b/examples/storage.rs @@ -196,9 +196,9 @@ async fn local() -> anyhow::Result<()> { let value = api.get("hello".to_string()).await?.await?; let mut list = api.list().await?; while let Some(value) = list.recv().await? { - println!("list value = {:?}", value); + println!("list value = {value:?}"); } - println!("value = {:?}", value); + println!("value = {value:?}"); Ok(()) } @@ -218,10 +218,10 @@ async fn remote() -> anyhow::Result<()> { .await? .await?; let value = api.get("hello".to_string()).await?.await?; - println!("value = {:?}", value); + println!("value = {value:?}"); let mut list = api.list().await?; while let Some(value) = list.recv().await? { - println!("list value = {:?}", value); + println!("list value = {value:?}"); } drop(handle); Ok(()) diff --git a/irpc-derive/src/lib.rs b/irpc-derive/src/lib.rs index 754889e..eaac093 100644 --- a/irpc-derive/src/lib.rs +++ b/irpc-derive/src/lib.rs @@ -128,7 +128,7 @@ fn generate_type_aliases( for (variant_name, inner_type) in variants { // Create a type name using the variant name + suffix // For example: Sum + "Msg" = SumMsg - let type_name = format!("{}{}", variant_name, suffix); + let type_name = format!("{variant_name}{suffix}"); let type_ident = Ident::new(&type_name, variant_name.span()); let alias = quote! { @@ -392,7 +392,7 @@ impl Parse for MacroArgs { _ => { return Err(syn::Error::new( param_name.span(), - format!("Unknown parameter: {}", param_name), + format!("Unknown parameter: {param_name}"), )); } } diff --git a/irpc-iroh/examples/auth.rs b/irpc-iroh/examples/auth.rs index 5e952d8..6abf584 100644 --- a/irpc-iroh/examples/auth.rs +++ b/irpc-iroh/examples/auth.rs @@ -34,10 +34,10 @@ async fn remote() -> Result<()> { api.set("hello".to_string(), "world".to_string()).await?; api.set("goodbye".to_string(), "world".to_string()).await?; let value = api.get("hello".to_string()).await?; - println!("value = {:?}", value); + println!("value = {value:?}"); let mut list = api.list().await?; while let Some(value) = list.recv().await? { - println!("list value = {:?}", value); + println!("list value = {value:?}"); } // invalid authentication diff --git a/irpc-iroh/examples/derive.rs b/irpc-iroh/examples/derive.rs index 65881e0..e43814a 100644 --- a/irpc-iroh/examples/derive.rs +++ b/irpc-iroh/examples/derive.rs @@ -19,9 +19,9 @@ async fn local() -> Result<()> { let value = api.get("hello".to_string()).await?; let mut list = api.list().await?; while let Some(value) = list.recv().await? { - println!("list value = {:?}", value); + println!("list value = {value:?}"); } - println!("value = {:?}", value); + println!("value = {value:?}"); Ok(()) } @@ -41,10 +41,10 @@ async fn remote() -> Result<()> { api.set("hello".to_string(), "world".to_string()).await?; api.set("goodbye".to_string(), "world".to_string()).await?; let value = api.get("hello".to_string()).await?; - println!("value = {:?}", value); + println!("value = {value:?}"); let mut list = api.list().await?; while let Some(value) = list.recv().await? { - println!("list value = {:?}", value); + println!("list value = {value:?}"); } drop(server_router); Ok(()) diff --git a/tests/mpsc_channel.rs b/tests/mpsc_channel.rs index 28d7aa6..e397b37 100644 --- a/tests/mpsc_channel.rs +++ b/tests/mpsc_channel.rs @@ -48,7 +48,7 @@ async fn mpsc_sender_clone_closed_error() -> TestResult<()> { while send1.send(vec![1, 2, 3]).await.is_ok() {} match send1.send(vec![4, 5, 6]).await { Err(SendError::Io(e)) if e.kind() == ErrorKind::BrokenPipe => {} - e => panic!("Expected SendError::Io with kind BrokenPipe, got {:?}", e), + e => panic!("Expected SendError::Io with kind BrokenPipe, got {e:?}"), }; // check that closed signal was received by the second sender second_client.await?; diff --git a/tests/oneshot_channel.rs b/tests/oneshot_channel.rs index 3988721..2caaa51 100644 --- a/tests/oneshot_channel.rs +++ b/tests/oneshot_channel.rs @@ -96,7 +96,7 @@ async fn oneshot_serialize_error_send() -> TestResult<()> { let Err(cause) = server.await? else { panic!("server should have failed due to serialization error"); }; - println!("Server error: {:?}", cause); + println!("Server error: {cause:?}"); assert!(matches!(cause, RecvError::Io(e) if e.kind() == ErrorKind::ConnectionReset)); Ok(()) } @@ -113,7 +113,7 @@ async fn oneshot_serialize_error_recv() -> TestResult<()> { let Err(cause) = server.await? else { panic!("server should have failed due to serialization error"); }; - println!("Server error: {:?}", cause); + println!("Server error: {cause:?}"); assert!(matches!(cause, RecvError::Io(e) if e.kind() == ErrorKind::InvalidData)); Ok(()) }