@@ -112,7 +112,7 @@ impl PipeListener {
112112 let res = unsafe { GetOverlappedResult ( np. named_pipe , ol. as_mut_ptr ( ) , & mut bytes_transfered, WAIT_FOR_EVENT ) } ;
113113 match res {
114114 0 => {
115- return Err ( io:: Error :: last_os_error ( ) ) ;
115+ Err ( io:: Error :: last_os_error ( ) )
116116 }
117117 _ => {
118118 if let Some ( shutdown_signal) = self . handle_shutdown ( & np) {
@@ -129,10 +129,10 @@ impl PipeListener {
129129 Ok ( Some ( np) )
130130 }
131131 e => {
132- return Err ( io:: Error :: new (
132+ Err ( io:: Error :: new (
133133 io:: ErrorKind :: Other ,
134134 format ! ( "failed to connect pipe: {:?}" , e) ,
135- ) ) ;
135+ ) )
136136 }
137137 }
138138 }
@@ -165,12 +165,12 @@ impl PipeListener {
165165 // https://learn.microsoft.com/en-us/windows/win32/ipc/named-pipe-security-and-access-rights
166166 match unsafe { CreateNamedPipeW ( name. as_ptr ( ) , open_mode, PIPE_WAIT | PIPE_REJECT_REMOTE_CLIENTS , PIPE_UNLIMITED_INSTANCES , PIPE_BUFFER_SIZE , PIPE_BUFFER_SIZE , 0 , std:: ptr:: null_mut ( ) ) } {
167167 INVALID_HANDLE_VALUE => {
168- return Err ( io:: Error :: last_os_error ( ) )
168+ Err ( io:: Error :: last_os_error ( ) )
169169 }
170170 h => {
171- return Ok ( h)
171+ Ok ( h)
172172 } ,
173- } ;
173+ }
174174 }
175175
176176 pub fn close ( & self ) -> Result < ( ) > {
@@ -208,8 +208,8 @@ impl PipeConnection {
208208 let write_event = create_event ( ) ?;
209209 Ok ( PipeConnection {
210210 named_pipe : h,
211- read_event : read_event ,
212- write_event : write_event ,
211+ read_event,
212+ write_event,
213213 } )
214214 }
215215
@@ -236,15 +236,15 @@ impl PipeConnection {
236236 let res = unsafe { GetOverlappedResult ( self . named_pipe , ol. as_mut_ptr ( ) , & mut bytes_transfered, WAIT_FOR_EVENT ) } ;
237237 match res {
238238 0 => {
239- return Err ( handle_windows_error ( io:: Error :: last_os_error ( ) ) )
239+ Err ( handle_windows_error ( io:: Error :: last_os_error ( ) ) )
240240 }
241241 _ => {
242- return Ok ( bytes_transfered as usize )
242+ Ok ( bytes_transfered as usize )
243243 }
244244 }
245245 }
246246 ref e => {
247- return Err ( Error :: Others ( format ! ( "failed to read from pipe: {:?}" , e) ) )
247+ Err ( Error :: Others ( format ! ( "failed to read from pipe: {:?}" , e) ) )
248248 }
249249 }
250250 }
@@ -267,15 +267,15 @@ impl PipeConnection {
267267 let res = unsafe { GetOverlappedResult ( self . named_pipe , ol. as_mut_ptr ( ) , & mut bytes_transfered, WAIT_FOR_EVENT ) } ;
268268 match res {
269269 0 => {
270- return Err ( handle_windows_error ( io:: Error :: last_os_error ( ) ) )
270+ Err ( handle_windows_error ( io:: Error :: last_os_error ( ) ) )
271271 }
272272 _ => {
273- return Ok ( bytes_transfered as usize )
273+ Ok ( bytes_transfered as usize )
274274 }
275275 }
276276 }
277277 ref e => {
278- return Err ( Error :: Others ( format ! ( "failed to write to pipe: {:?}" , e) ) )
278+ Err ( Error :: Others ( format ! ( "failed to write to pipe: {:?}" , e) ) )
279279 }
280280 }
281281 }
@@ -346,10 +346,10 @@ impl ClientConnection {
346346 . custom_flags ( FILE_FLAG_OVERLAPPED ) ;
347347 match opts. open ( self . address . as_str ( ) ) {
348348 Ok ( file) => {
349- return PipeConnection :: new ( file. into_raw_handle ( ) as isize )
349+ PipeConnection :: new ( file. into_raw_handle ( ) as isize )
350350 }
351351 Err ( e) => {
352- return Err ( handle_windows_error ( e) )
352+ Err ( handle_windows_error ( e) )
353353 }
354354 }
355355 }
@@ -383,7 +383,7 @@ mod test {
383383 let client = ClientConnection :: new ( "non_existent_pipe" ) ;
384384 match client. get_pipe_connection ( ) {
385385 Ok ( _) => {
386- assert ! ( false , "should not be able to get a connection to a non existent pipe" ) ;
386+ panic ! ( "should not be able to get a connection to a non existent pipe" ) ;
387387 }
388388 Err ( e) => {
389389 assert_eq ! ( e, Error :: Windows ( ERROR_FILE_NOT_FOUND as i32 ) ) ;
@@ -404,10 +404,10 @@ mod test {
404404 // pipe is working
405405 }
406406 Ok ( None ) => {
407- assert ! ( false , "should get a working pipe" )
407+ panic ! ( "should get a working pipe" )
408408 }
409409 Err ( e) => {
410- assert ! ( false , "should not get error {}" , e. to_string ( ) )
410+ panic ! ( "should not get error {}" , e)
411411 }
412412 }
413413 } ) ;
@@ -425,7 +425,7 @@ mod test {
425425 let quit_flag = Arc :: new ( AtomicBool :: new ( false ) ) ;
426426 match listener_server. accept ( & quit_flag) {
427427 Ok ( _) => {
428- assert ! ( false , "should not get pipe on close" )
428+ panic ! ( "should not get pipe on close" )
429429 }
430430 Err ( e) => {
431431 assert_eq ! ( e. to_string( ) , "closing pipe" )
0 commit comments