@@ -135,8 +135,7 @@ impl FileDescription for AnonSocket {
135135
136136 // Always succeed on read size 0.
137137 if request_byte_size == 0 {
138- let result = Ok ( 0 ) ;
139- ecx. read_byte_helper ( ptr, bytes. to_vec ( ) , result, dest) ?;
138+ ecx. read_byte_helper ( ptr, bytes. to_vec ( ) , Ok ( 0 ) , dest) ?;
140139 return Ok ( ( ) ) ;
141140 }
142141
@@ -150,8 +149,7 @@ impl FileDescription for AnonSocket {
150149 if self . peer_fd ( ) . upgrade ( ) . is_none ( ) {
151150 // Socketpair with no peer and empty buffer.
152151 // 0 bytes successfully read indicates end-of-file.
153- let result = Ok ( 0 ) ;
154- ecx. read_byte_helper ( ptr, bytes. to_vec ( ) , result, dest) ?;
152+ ecx. read_byte_helper ( ptr, bytes. to_vec ( ) , Ok ( 0 ) , dest) ?;
155153 return Ok ( ( ) ) ;
156154 } else {
157155 if self . is_nonblock {
@@ -160,8 +158,12 @@ impl FileDescription for AnonSocket {
160158 // EAGAIN or EWOULDBLOCK can be returned for socket,
161159 // POSIX.1-2001 allows either error to be returned for this case.
162160 // Since there is no ErrorKind for EAGAIN, WouldBlock is used.
163- let result = Err ( Error :: from ( ErrorKind :: WouldBlock ) ) ;
164- ecx. read_byte_helper ( ptr, bytes. to_vec ( ) , result, dest) ?;
161+ ecx. read_byte_helper (
162+ ptr,
163+ bytes. to_vec ( ) ,
164+ Err ( Error :: from ( ErrorKind :: WouldBlock ) ) ,
165+ dest,
166+ ) ?;
165167 return Ok ( ( ) ) ;
166168 } else {
167169 // Blocking socketpair with writer and empty buffer.
@@ -194,8 +196,7 @@ impl FileDescription for AnonSocket {
194196 ecx. check_and_update_readiness ( & peer_fd) ?;
195197 }
196198
197- let result = Ok ( actual_read_size) ;
198- ecx. read_byte_helper ( ptr, bytes. to_vec ( ) , result, dest) ?;
199+ ecx. read_byte_helper ( ptr, bytes. to_vec ( ) , Ok ( actual_read_size) , dest) ?;
199200 return Ok ( ( ) ) ;
200201 }
201202
@@ -211,17 +212,15 @@ impl FileDescription for AnonSocket {
211212 // Always succeed on write size 0.
212213 // ("If count is zero and fd refers to a file other than a regular file, the results are not specified.")
213214 if write_size == 0 {
214- let result = Ok ( 0 ) ;
215- ecx. write_byte_helper ( result, dest) ?;
215+ ecx. write_byte_helper ( Ok ( 0 ) , dest) ?;
216216 return Ok ( ( ) ) ;
217217 }
218218
219219 // We are writing to our peer's readbuf.
220220 let Some ( peer_fd) = self . peer_fd ( ) . upgrade ( ) else {
221221 // If the upgrade from Weak to Rc fails, it indicates that all read ends have been
222222 // closed.
223- let result = Err ( Error :: from ( ErrorKind :: BrokenPipe ) ) ;
224- ecx. write_byte_helper ( result, dest) ?;
223+ ecx. write_byte_helper ( Err ( Error :: from ( ErrorKind :: BrokenPipe ) ) , dest) ?;
225224 return Ok ( ( ) ) ;
226225 } ;
227226
@@ -236,8 +235,7 @@ impl FileDescription for AnonSocket {
236235 if available_space == 0 {
237236 if self . is_nonblock {
238237 // Non-blocking socketpair with a full buffer.
239- let result = Err ( Error :: from ( ErrorKind :: WouldBlock ) ) ;
240- ecx. write_byte_helper ( result, dest) ?;
238+ ecx. write_byte_helper ( Err ( Error :: from ( ErrorKind :: WouldBlock ) ) , dest) ?;
241239 return Ok ( ( ) ) ;
242240 } else {
243241 // Blocking socketpair with a full buffer.
@@ -259,8 +257,7 @@ impl FileDescription for AnonSocket {
259257 // The kernel does this even if the fd was already readable before, so we follow suit.
260258 ecx. check_and_update_readiness ( & peer_fd) ?;
261259
262- let result = Ok ( actual_write_size) ;
263- ecx. write_byte_helper ( result, dest) ?;
260+ ecx. write_byte_helper ( Ok ( actual_write_size) , dest) ?;
264261 return Ok ( ( ) ) ;
265262 }
266263}
0 commit comments