@@ -72,17 +72,15 @@ impl FileDescription for Event {
7272 // Check the size of slice, and return error only if the size of the slice < 8.
7373 if len < U64_ARRAY_SIZE . try_into ( ) . unwrap ( ) {
7474 let result = Err ( Error :: from ( ErrorKind :: InvalidInput ) ) ;
75- return_read_bytes_and_count_ev ( & buf_place, None , result, dest, ecx) ?;
76- return Ok ( ( ) ) ;
75+ return return_read_bytes_and_count_ev ( & buf_place, None , result, dest, ecx) ;
7776 }
7877
7978 // Block when counter == 0.
8079 let counter = self . counter . get ( ) ;
8180 if counter == 0 {
8281 if self . is_nonblock {
8382 let result = Err ( Error :: from ( ErrorKind :: WouldBlock ) ) ;
84- return_read_bytes_and_count_ev ( & buf_place, None , result, dest, ecx) ?;
85- return Ok ( ( ) ) ;
83+ return return_read_bytes_and_count_ev ( & buf_place, None , result, dest, ecx) ;
8684 } else {
8785 //FIXME: blocking is not supported
8886 throw_unsup_format ! ( "eventfd: blocking is unsupported" ) ;
@@ -91,13 +89,12 @@ impl FileDescription for Event {
9189 // Synchronize with all prior `write` calls to this FD.
9290 ecx. acquire_clock ( & self . clock . borrow ( ) ) ;
9391 let result = Ok ( U64_ARRAY_SIZE ) ;
94- return_read_bytes_and_count_ev ( & buf_place, Some ( counter) , result, dest, ecx) ?;
9592 self . counter . set ( 0 ) ;
9693 // When any of the event happened, we check and update the status of all supported event
9794 // types for current file description.
9895 ecx. check_and_update_readiness ( self_ref) ?;
9996
100- return Ok ( ( ) ) ;
97+ return_read_bytes_and_count_ev ( & buf_place , Some ( counter ) , result , dest , ecx )
10198 }
10299 }
103100
@@ -124,8 +121,7 @@ impl FileDescription for Event {
124121 // Check the size of slice, and return error only if the size of the slice < 8.
125122 let Some ( bytes) = bytes. first_chunk :: < U64_ARRAY_SIZE > ( ) else {
126123 let result = Err ( Error :: from ( ErrorKind :: InvalidInput ) ) ;
127- ecx. return_written_byte_count_or_error ( result, dest) ?;
128- return Ok ( ( ) ) ;
124+ return ecx. return_written_byte_count_or_error ( result, dest) ;
129125 } ;
130126 // Convert from bytes to int according to host endianness.
131127 let num = match ecx. tcx . sess . target . endian {
@@ -135,8 +131,7 @@ impl FileDescription for Event {
135131 // u64::MAX as input is invalid because the maximum value of counter is u64::MAX - 1.
136132 if num == u64:: MAX {
137133 let result = Err ( Error :: from ( ErrorKind :: InvalidInput ) ) ;
138- ecx. return_written_byte_count_or_error ( result, dest) ?;
139- return Ok ( ( ) ) ;
134+ return ecx. return_written_byte_count_or_error ( result, dest) ;
140135 }
141136 // If the addition does not let the counter to exceed the maximum value, update the counter.
142137 // Else, block.
@@ -151,8 +146,7 @@ impl FileDescription for Event {
151146 None | Some ( u64:: MAX ) => {
152147 if self . is_nonblock {
153148 let result = Err ( Error :: from ( ErrorKind :: WouldBlock ) ) ;
154- ecx. return_written_byte_count_or_error ( result, dest) ?;
155- return Ok ( ( ) ) ;
149+ return ecx. return_written_byte_count_or_error ( result, dest) ;
156150 } else {
157151 //FIXME: blocking is not supported
158152 throw_unsup_format ! ( "eventfd: blocking is unsupported" ) ;
@@ -164,8 +158,7 @@ impl FileDescription for Event {
164158 ecx. check_and_update_readiness ( self_ref) ?;
165159
166160 let result = Ok ( U64_ARRAY_SIZE ) ;
167- ecx. return_written_byte_count_or_error ( result, dest) ?;
168- Ok ( ( ) )
161+ ecx. return_written_byte_count_or_error ( result, dest)
169162 }
170163}
171164
0 commit comments