@@ -147,7 +147,7 @@ pub fn invocation_subject(prefix: &str, instance: &str, func: &str) -> String {
147147}
148148
149149fn corrupted_memory_error ( ) -> std:: io:: Error {
150- std:: io:: Error :: new ( std :: io :: ErrorKind :: Other , "corrupted memory state" )
150+ std:: io:: Error :: other ( "corrupted memory state" )
151151}
152152
153153/// Transport subscriber
@@ -735,8 +735,7 @@ impl RootParamWriter {
735735 status : Some ( code) ,
736736 description,
737737 ..
738- } ) ) if !code. is_success ( ) => Poll :: Ready ( Err ( std:: io:: Error :: new (
739- std:: io:: ErrorKind :: Other ,
738+ } ) ) if !code. is_success ( ) => Poll :: Ready ( Err ( std:: io:: Error :: other (
740739 if let Some ( description) = description {
741740 format ! ( "received a response with code `{code}` ({description})" )
742741 } else {
@@ -757,13 +756,11 @@ impl RootParamWriter {
757756 return Poll :: Ready ( Err ( corrupted_memory_error ( ) ) ) ;
758757 } ;
759758 let tx = SubjectWriter :: new ( nats, Subject :: from ( param_subject ( & tx) ) , tasks) ;
760- let indexed = indexed. into_inner ( ) . map_err ( |err| {
761- std :: io :: Error :: new ( std :: io :: ErrorKind :: Other , err . to_string ( ) )
762- } ) ?;
759+ let indexed = indexed
760+ . into_inner ( )
761+ . map_err ( |err| std :: io :: Error :: other ( err . to_string ( ) ) ) ?;
763762 for ( path, tx_tx) in indexed {
764- let tx = tx. index ( & path) . map_err ( |err| {
765- std:: io:: Error :: new ( std:: io:: ErrorKind :: Other , err)
766- } ) ?;
763+ let tx = tx. index ( & path) . map_err ( std:: io:: Error :: other) ?;
767764 tx_tx. send ( tx) . map_err ( |_| {
768765 std:: io:: Error :: from ( std:: io:: ErrorKind :: BrokenPipe )
769766 } ) ?;
@@ -820,9 +817,9 @@ impl wrpc_transport::Index<IndexedParamWriter> for RootParamWriter {
820817 Self :: Corrupted => Err ( anyhow ! ( corrupted_memory_error( ) ) ) ,
821818 Self :: Handshaking { indexed, .. } => {
822819 let ( tx_tx, tx_rx) = oneshot:: channel ( ) ;
823- let mut indexed = indexed. lock ( ) . map_err ( |err| {
824- std :: io :: Error :: new ( std :: io :: ErrorKind :: Other , err . to_string ( ) )
825- } ) ?;
820+ let mut indexed = indexed
821+ . lock ( )
822+ . map_err ( |err| std :: io :: Error :: other ( err . to_string ( ) ) ) ?;
826823 indexed. push ( ( path. to_vec ( ) , tx_tx) ) ;
827824 Ok ( IndexedParamWriter :: Handshaking {
828825 tx_rx,
@@ -907,13 +904,11 @@ impl IndexedParamWriter {
907904 let Self :: Handshaking { indexed, .. } = mem:: take ( & mut * self ) else {
908905 return Poll :: Ready ( Err ( corrupted_memory_error ( ) ) ) ;
909906 } ;
910- let indexed = indexed. into_inner ( ) . map_err ( |err| {
911- std :: io :: Error :: new ( std :: io :: ErrorKind :: Other , err . to_string ( ) )
912- } ) ?;
907+ let indexed = indexed
908+ . into_inner ( )
909+ . map_err ( |err| std :: io :: Error :: other ( err . to_string ( ) ) ) ?;
913910 for ( path, tx_tx) in indexed {
914- let tx = tx. index ( & path) . map_err ( |err| {
915- std:: io:: Error :: new ( std:: io:: ErrorKind :: Other , err)
916- } ) ?;
911+ let tx = tx. index ( & path) . map_err ( std:: io:: Error :: other) ?;
917912 tx_tx. send ( tx) . map_err ( |_| {
918913 std:: io:: Error :: from ( std:: io:: ErrorKind :: BrokenPipe )
919914 } ) ?;
@@ -938,9 +933,9 @@ impl wrpc_transport::Index<Self> for IndexedParamWriter {
938933 Self :: Corrupted => Err ( anyhow ! ( corrupted_memory_error( ) ) ) ,
939934 Self :: Handshaking { indexed, .. } => {
940935 let ( tx_tx, tx_rx) = oneshot:: channel ( ) ;
941- let mut indexed = indexed. lock ( ) . map_err ( |err| {
942- std :: io :: Error :: new ( std :: io :: ErrorKind :: Other , err . to_string ( ) )
943- } ) ?;
936+ let mut indexed = indexed
937+ . lock ( )
938+ . map_err ( |err| std :: io :: Error :: other ( err . to_string ( ) ) ) ?;
944939 indexed. push ( ( path. to_vec ( ) , tx_tx) ) ;
945940 Ok ( Self :: Handshaking {
946941 tx_rx,
0 commit comments