@@ -180,9 +180,9 @@ impl<'a> ConsumableBytes<'a> {
180
180
181
181
fn consume_next ( & mut self ) -> ConsumeResult < u8 > {
182
182
let r = self . next ( ) ;
183
- if r . is_some ( ) {
183
+ if let Some ( unwrapped_r ) = r {
184
184
self . consume_bytes ( 1 ) ;
185
- ConsumeResult :: Consumed ( r . unwrap ( ) )
185
+ ConsumeResult :: Consumed ( unwrapped_r )
186
186
} else if self . end_of_stream {
187
187
ConsumeResult :: EndOfStream
188
188
} else {
@@ -192,7 +192,7 @@ impl<'a> ConsumableBytes<'a> {
192
192
193
193
fn unsigned_number ( & mut self ) -> Result < NumberLength , DecodeError > {
194
194
match self . consume_next ( ) {
195
- ConsumeResult :: Consumed ( b'1' ... b'9' ) => Ok ( self . int_digits ( ) ? + 1 ) ,
195
+ ConsumeResult :: Consumed ( b'1' ..= b'9' ) => Ok ( self . int_digits ( ) ? + 1 ) ,
196
196
ConsumeResult :: Consumed ( b'0' ) => Ok ( self . decimal_point ( ) ? + 1 ) ,
197
197
ConsumeResult :: Consumed ( c) => Err ( DecodeError :: UnexpectedByte ( c) ) ,
198
198
ConsumeResult :: EndOfStream => Err ( DecodeError :: UnexpectedEndOfStream ) ,
@@ -202,7 +202,7 @@ impl<'a> ConsumableBytes<'a> {
202
202
203
203
fn fraction_first_digit ( & mut self ) -> Result < NumberLength , DecodeError > {
204
204
match self . consume_next ( ) {
205
- ConsumeResult :: Consumed ( b'0' ... b'9' ) => Ok ( self . fraction_digits ( ) ? + 1 ) ,
205
+ ConsumeResult :: Consumed ( b'0' ..= b'9' ) => Ok ( self . fraction_digits ( ) ? + 1 ) ,
206
206
ConsumeResult :: Consumed ( c) => Err ( DecodeError :: UnexpectedByte ( c) ) ,
207
207
ConsumeResult :: EndOfStream => Err ( DecodeError :: UnexpectedEndOfStream ) ,
208
208
ConsumeResult :: EndOfChunk => Err ( DecodeError :: NeedsMore ) ,
@@ -213,7 +213,7 @@ impl<'a> ConsumableBytes<'a> {
213
213
let mut i = 0 ;
214
214
loop {
215
215
match self . consume_next ( ) {
216
- ConsumeResult :: Consumed ( b'0' ... b'9' ) => i += 1 ,
216
+ ConsumeResult :: Consumed ( b'0' ..= b'9' ) => i += 1 ,
217
217
ConsumeResult :: Consumed ( b'e' ) | ConsumeResult :: Consumed ( b'E' ) => {
218
218
return Ok ( self . exp ( ) ? + i + 1 )
219
219
}
@@ -226,7 +226,7 @@ impl<'a> ConsumableBytes<'a> {
226
226
227
227
fn exp_first_digit ( & mut self ) -> Result < NumberLength , DecodeError > {
228
228
match self . consume_next ( ) {
229
- ConsumeResult :: Consumed ( b'0' ... b'9' ) => Ok ( self . exp_digits ( ) ? + 1 ) ,
229
+ ConsumeResult :: Consumed ( b'0' ..= b'9' ) => Ok ( self . exp_digits ( ) ? + 1 ) ,
230
230
ConsumeResult :: Consumed ( c) => Err ( DecodeError :: UnexpectedByte ( c) ) ,
231
231
ConsumeResult :: EndOfStream => Err ( DecodeError :: UnexpectedEndOfStream ) ,
232
232
ConsumeResult :: EndOfChunk => Err ( DecodeError :: NeedsMore ) ,
@@ -237,7 +237,7 @@ impl<'a> ConsumableBytes<'a> {
237
237
let mut i = 0 ;
238
238
loop {
239
239
match self . consume_next ( ) {
240
- ConsumeResult :: Consumed ( b'0' ... b'9' ) => {
240
+ ConsumeResult :: Consumed ( b'0' ..= b'9' ) => {
241
241
i += 1 ;
242
242
}
243
243
ConsumeResult :: Consumed ( _) => return Ok ( i. into ( ) ) ,
@@ -252,7 +252,7 @@ impl<'a> ConsumableBytes<'a> {
252
252
ConsumeResult :: Consumed ( b'+' ) | ConsumeResult :: Consumed ( b'-' ) => {
253
253
Ok ( self . exp_first_digit ( ) ? + 1 )
254
254
}
255
- ConsumeResult :: Consumed ( b'0' ... b'9' ) => Ok ( self . exp_digits ( ) ? + 1 ) ,
255
+ ConsumeResult :: Consumed ( b'0' ..= b'9' ) => Ok ( self . exp_digits ( ) ? + 1 ) ,
256
256
ConsumeResult :: Consumed ( c) => Err ( DecodeError :: UnexpectedByte ( c) ) ,
257
257
ConsumeResult :: EndOfStream => Err ( DecodeError :: UnexpectedEndOfStream ) ,
258
258
ConsumeResult :: EndOfChunk => Err ( DecodeError :: NeedsMore ) ,
@@ -264,7 +264,7 @@ impl<'a> ConsumableBytes<'a> {
264
264
match c {
265
265
ConsumeResult :: Consumed ( b'.' ) => Ok ( self . fraction_first_digit ( ) ? + 1 ) ,
266
266
ConsumeResult :: Consumed ( b'e' ) | ConsumeResult :: Consumed ( b'E' ) => Ok ( self . exp ( ) ? + 1 ) ,
267
- ConsumeResult :: Consumed ( b'0' ... b'9' ) => Err ( DecodeError :: UnexpectedByte ( c. unwrap ( ) ) ) ,
267
+ ConsumeResult :: Consumed ( b'0' ..= b'9' ) => Err ( DecodeError :: UnexpectedByte ( c. unwrap ( ) ) ) ,
268
268
ConsumeResult :: Consumed ( _) => Ok ( 0 . into ( ) ) ,
269
269
ConsumeResult :: EndOfStream => Ok ( 0 . into ( ) ) ,
270
270
ConsumeResult :: EndOfChunk => Err ( DecodeError :: NeedsMore ) ,
@@ -275,7 +275,7 @@ impl<'a> ConsumableBytes<'a> {
275
275
let mut i = 0 ;
276
276
loop {
277
277
match self . consume_next ( ) {
278
- ConsumeResult :: Consumed ( b'0' ... b'9' ) => i += 1 ,
278
+ ConsumeResult :: Consumed ( b'0' ..= b'9' ) => i += 1 ,
279
279
ConsumeResult :: Consumed ( b'.' ) => return Ok ( self . fraction_first_digit ( ) ? + i + 1 ) ,
280
280
ConsumeResult :: Consumed ( b'e' ) | ConsumeResult :: Consumed ( b'E' ) => {
281
281
return Ok ( self . exp ( ) ? + i + 1 )
@@ -396,7 +396,7 @@ impl JsonDecoder {
396
396
bs. consume_bytes ( 1 ) ;
397
397
self . number_of_len ( bytes, bs. decimal_point ( ) ? + 1 )
398
398
}
399
- Some ( b'1' ... b'9' ) => {
399
+ Some ( b'1' ..= b'9' ) => {
400
400
let mut bs = bytes. clone ( ) ;
401
401
bs. consume_bytes ( 1 ) ;
402
402
self . number_of_len ( bytes, bs. int_digits ( ) ? + 1 )
@@ -729,7 +729,7 @@ mod tests {
729
729
ConsumedValue :: Value ( Value :: Number ( {
730
730
// I want to do: .expect("Should be able to read JSON number from string.")
731
731
//
732
- // But sadly... serde_json cannot handle super large number, fake a
732
+ // But sadly..= serde_json cannot handle super large number, fake a
733
733
// different error in that case for now.
734
734
match Number :: from_str ( s) {
735
735
Ok ( o) => o,
0 commit comments