@@ -447,7 +447,7 @@ where
447
447
}
448
448
}
449
449
450
- fn parse_octet ( & mut self , first : char ) -> Result < char , LexicalError > {
450
+ fn parse_octet ( & mut self , first : char ) -> char {
451
451
let mut octet_content = String :: new ( ) ;
452
452
octet_content. push ( first) ;
453
453
while octet_content. len ( ) < 3 {
@@ -457,13 +457,8 @@ where
457
457
break ;
458
458
}
459
459
}
460
- match u32:: from_str_radix ( & octet_content, 8 ) {
461
- Ok ( result) => Ok ( char:: from_u32 ( result) . unwrap ( ) ) ,
462
- Err ( error) => Err ( LexicalError {
463
- error : LexicalErrorType :: OtherError ( error. to_string ( ) ) ,
464
- location : self . get_pos ( ) ,
465
- } ) ,
466
- }
460
+ let value = u32:: from_str_radix ( & octet_content, 8 ) . unwrap ( ) ;
461
+ char:: from_u32 ( value) . unwrap ( )
467
462
}
468
463
469
464
fn parse_unicode_name ( & mut self ) -> Result < char , LexicalError > {
@@ -555,7 +550,7 @@ where
555
550
string_content. push ( '\t' ) ;
556
551
}
557
552
Some ( 'v' ) => string_content. push ( '\x0b' ) ,
558
- Some ( o @ '0' ..='7' ) => string_content. push ( self . parse_octet ( o) ? ) ,
553
+ Some ( o @ '0' ..='7' ) => string_content. push ( self . parse_octet ( o) ) ,
559
554
Some ( 'x' ) => string_content. push ( self . unicode_literal ( 2 ) ?) ,
560
555
Some ( 'u' ) if !is_bytes => string_content. push ( self . unicode_literal ( 4 ) ?) ,
561
556
Some ( 'U' ) if !is_bytes => string_content. push ( self . unicode_literal ( 8 ) ?) ,
0 commit comments