File tree Expand file tree Collapse file tree 2 files changed +3
-7
lines changed Expand file tree Collapse file tree 2 files changed +3
-7
lines changed Original file line number Diff line number Diff line change @@ -339,11 +339,7 @@ where
339
339
340
340
let segment_count = u32:: from_le_bytes ( buf[ 0 ..4 ] . try_into ( ) . unwrap ( ) ) . wrapping_add ( 1 ) as usize ;
341
341
342
- if segment_count >= SEGMENTS_COUNT_LIMIT {
343
- return Err ( Error :: from_kind ( ErrorKind :: InvalidNumberOfSegments (
344
- segment_count,
345
- ) ) ) ;
346
- } else if segment_count == 0 {
342
+ if segment_count >= SEGMENTS_COUNT_LIMIT || segment_count == 0 {
347
343
return Err ( Error :: from_kind ( ErrorKind :: InvalidNumberOfSegments (
348
344
segment_count,
349
345
) ) ) ;
Original file line number Diff line number Diff line change @@ -174,12 +174,12 @@ impl<'a> Builder<'a> {
174
174
}
175
175
176
176
pub fn as_bytes ( self ) -> & ' a [ u8 ] {
177
- & self . bytes [ .. ]
177
+ self . bytes
178
178
}
179
179
180
180
/// Converts to a `str`, returning a error if the data contains invalid utf-8.
181
181
pub fn to_str ( self ) -> core:: result:: Result < & ' a str , core:: str:: Utf8Error > {
182
- str:: from_utf8 ( & self . bytes [ .. ] )
182
+ str:: from_utf8 ( self . bytes )
183
183
}
184
184
185
185
#[ cfg( feature = "alloc" ) ]
You can’t perform that action at this time.
0 commit comments