@@ -184,7 +184,7 @@ where
184184 }
185185
186186 let byte = peek_one ( r) ?;
187- return Ok ( match dec:: if_major ( byte) {
187+ Ok ( match dec:: if_major ( byte) {
188188 major:: UNSIGNED => u64:: decode ( r) ?. into_pyobject ( py) ?. into ( ) ,
189189 major:: NEGATIVE => i128:: decode ( r) ?. into_pyobject ( py) ?. into ( ) ,
190190 major:: BYTES => PyBytes :: new ( py, <types:: Bytes < & [ u8 ] > >:: decode ( r) ?. 0 )
@@ -233,7 +233,7 @@ where
233233
234234 if let Some ( prev_key) = prev_key {
235235 // it cares about duplicated keys too thanks to Ordering::Equal
236- if map_key_cmp ( & prev_key, & key) != std:: cmp:: Ordering :: Less {
236+ if map_key_cmp ( prev_key, key) != std:: cmp:: Ordering :: Less {
237237 return Err ( anyhow ! ( "Map keys must be sorted and unique" ) ) ;
238238 }
239239 }
@@ -256,11 +256,11 @@ where
256256 let cid = <types:: Bytes < & [ u8 ] > >:: decode ( r) ?. 0 ;
257257
258258 // Parse the CID for validation. They have a zero byte at the front, strip it off.
259- if let Err ( _ ) = Cid :: try_from ( & cid[ 1 ..] ) {
259+ if Cid :: try_from ( & cid[ 1 ..] ) . is_err ( ) {
260260 return Err ( anyhow ! ( "Invalid CID" ) ) ;
261261 }
262262
263- PyBytes :: new ( py, & cid) . into_pyobject ( py) ?. into ( )
263+ PyBytes :: new ( py, cid) . into_pyobject ( py) ?. into ( )
264264 }
265265 major:: SIMPLE => match byte {
266266 // FIXME(MarshalX): should be more clear for bool?
@@ -297,7 +297,7 @@ where
297297 _ => return Err ( anyhow ! ( "Unsupported major type" . to_string( ) ) ) ,
298298 } ,
299299 _ => return Err ( anyhow ! ( "Invalid major type" . to_string( ) ) ) ,
300- } ) ;
300+ } )
301301}
302302
303303fn encode_dag_cbor_from_pyobject < ' py , W : enc:: Write > (
@@ -538,8 +538,7 @@ pub fn decode_dag_cbor(py: Python, data: &[u8]) -> PyResult<Py<PyAny>> {
538538 . fill ( 1 )
539539 . expect ( "SliceReader never fails" )
540540 . as_ref ( )
541- . len ( )
542- == 0
541+ . is_empty ( )
543542 {
544543 Ok ( py_object)
545544 } else {
0 commit comments