@@ -161,15 +161,15 @@ impl ZstdWriter {
161161 panic ! ( "`get_state` called on a single threaded writer" )
162162 } ;
163163
164- return state;
164+ state
165165 }
166166
167167 fn get_state_mut ( & mut self ) -> & mut MultiThreadedState {
168168 let WriterMode :: MultiThreaded ( state) = & mut self . mode else {
169169 panic ! ( "`get_state_mut` called on a single threaded writer" )
170170 } ;
171171
172- return state;
172+ state
173173 }
174174
175175 fn instantiate_writer ( refs : Option < DigestMap > ) -> zstd:: Encoder < ' static , Vec < u8 > > {
@@ -190,7 +190,7 @@ impl ZstdWriter {
190190 }
191191 }
192192
193- return writer;
193+ writer
194194 }
195195
196196 pub ( crate ) fn write_fragment ( & mut self , size : usize , data : & [ u8 ] ) -> Result < ( ) > {
@@ -200,19 +200,19 @@ impl ZstdWriter {
200200
201201 pub ( crate ) fn update_sha ( & mut self , data : & [ u8 ] ) {
202202 if let Some ( ( sha256, ..) ) = & mut self . sha256_builder {
203- sha256. update ( & data) ;
203+ sha256. update ( data) ;
204204 }
205205 }
206206
207207 /// Writes all the data in `inline_content`, updating the internal SHA
208- pub ( crate ) fn flush_inline ( & mut self , inline_content : & Vec < u8 > ) -> Result < ( ) > {
208+ pub ( crate ) fn flush_inline ( & mut self , inline_content : & [ u8 ] ) -> Result < ( ) > {
209209 if inline_content. is_empty ( ) {
210210 return Ok ( ( ) ) ;
211211 }
212212
213213 self . update_sha ( inline_content) ;
214214
215- self . write_fragment ( inline_content. len ( ) , & inline_content) ?;
215+ self . write_fragment ( inline_content. len ( ) , inline_content) ?;
216216
217217 Ok ( ( ) )
218218 }
@@ -265,7 +265,7 @@ impl ZstdWriter {
265265 }
266266
267267 pub ( crate ) fn finalize_sha256_builder ( & mut self ) -> Result < Sha256HashValue > {
268- let sha256_builder = std :: mem :: replace ( & mut self . sha256_builder , None ) ;
268+ let sha256_builder = self . sha256_builder . take ( ) ;
269269
270270 if let Some ( ( context, expected) ) = sha256_builder {
271271 let final_sha = Into :: < Sha256HashValue > :: into ( context. finalize ( ) ) ;
@@ -305,7 +305,7 @@ impl ZstdWriter {
305305 seq_num : final_message. total_msgs ,
306306 layer_num : final_message. layer_num ,
307307 } ) )
308- . with_context ( || format ! ( "Failed to send object finalize message" ) ) ?;
308+ . context ( "Failed to send object finalize message" ) ?;
309309
310310 Ok ( sha)
311311 }
@@ -374,6 +374,6 @@ impl ZstdWriter {
374374 }
375375 }
376376
377- return Ok ( false ) ;
377+ Ok ( false )
378378 }
379379}
0 commit comments