From 66aaa5bb291c0983dc033ee14e094f7d9dd0a5a5 Mon Sep 17 00:00:00 2001 From: tottoto Date: Sat, 11 Jan 2025 13:48:42 +0900 Subject: [PATCH] chore: Use specific io error constructor (#2133) --- examples/src/mock/mock.rs | 5 +---- tests/integration_tests/tests/max_message_size.rs | 10 ++-------- tests/integration_tests/tests/status.rs | 2 +- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/examples/src/mock/mock.rs b/examples/src/mock/mock.rs index 6c26a6735..fd6be0482 100644 --- a/examples/src/mock/mock.rs +++ b/examples/src/mock/mock.rs @@ -39,10 +39,7 @@ async fn main() -> Result<(), Box> { if let Some(client) = client { Ok(TokioIo::new(client)) } else { - Err(std::io::Error::new( - std::io::ErrorKind::Other, - "Client already taken", - )) + Err(std::io::Error::other("Client already taken")) } } })) diff --git a/tests/integration_tests/tests/max_message_size.rs b/tests/integration_tests/tests/max_message_size.rs index f03699cdf..0de102066 100644 --- a/tests/integration_tests/tests/max_message_size.rs +++ b/tests/integration_tests/tests/max_message_size.rs @@ -166,10 +166,7 @@ async fn response_stream_limit() { if let Some(client) = client { Ok(TokioIo::new(client)) } else { - Err(std::io::Error::new( - std::io::ErrorKind::Other, - "Client already taken", - )) + Err(std::io::Error::other("Client already taken")) } } })) @@ -335,10 +332,7 @@ async fn max_message_run(case: &TestCase) -> Result<(), Status> { if let Some(client) = client { Ok(TokioIo::new(client)) } else { - Err(std::io::Error::new( - std::io::ErrorKind::Other, - "Client already taken", - )) + Err(std::io::Error::other("Client already taken")) } } })) diff --git a/tests/integration_tests/tests/status.rs b/tests/integration_tests/tests/status.rs index b388611f9..84337d130 100644 --- a/tests/integration_tests/tests/status.rs +++ b/tests/integration_tests/tests/status.rs @@ -198,7 +198,7 @@ async fn status_from_server_stream_with_source() { let channel = Endpoint::try_from("http://[::]:50051") .unwrap() .connect_with_connector_lazy(tower::service_fn(move |_: Uri| async move { - Err::, _>(std::io::Error::new(std::io::ErrorKind::Other, "WTF")) + Err::, _>(std::io::Error::other("WTF")) })); let mut client = test_stream_client::TestStreamClient::new(channel);