@@ -222,7 +222,7 @@ where
222
222
{
223
223
loop {
224
224
let ch = tri ! ( next_or_eof( self ) ) ;
225
- if !ESCAPE [ ch as usize ] {
225
+ if !is_escape ( ch ) {
226
226
scratch. push ( ch) ;
227
227
continue ;
228
228
}
@@ -343,7 +343,7 @@ where
343
343
fn ignore_str ( & mut self ) -> Result < ( ) > {
344
344
loop {
345
345
let ch = tri ! ( next_or_eof( self ) ) ;
346
- if !ESCAPE [ ch as usize ] {
346
+ if !is_escape ( ch ) {
347
347
continue ;
348
348
}
349
349
match ch {
@@ -819,33 +819,11 @@ pub trait Fused: private::Sealed {}
819
819
impl < ' a > Fused for SliceRead < ' a > { }
820
820
impl < ' a > Fused for StrRead < ' a > { }
821
821
822
- // Lookup table of bytes that must be escaped. A value of true at index i means
823
- // that byte i requires an escape sequence in the input.
824
- static ESCAPE : [ bool ; 256 ] = {
825
- const CT : bool = true ; // control character \x00..=\x1F
826
- const QU : bool = true ; // quote \x22
827
- const BS : bool = true ; // backslash \x5C
828
- const __: bool = false ; // allow unescaped
829
- [
830
- // 1 2 3 4 5 6 7 8 9 A B C D E F
831
- CT , CT , CT , CT , CT , CT , CT , CT , CT , CT , CT , CT , CT , CT , CT , CT , // 0
832
- CT , CT , CT , CT , CT , CT , CT , CT , CT , CT , CT , CT , CT , CT , CT , CT , // 1
833
- __, __, QU , __, __, __, __, __, __, __, __, __, __, __, __, __, // 2
834
- __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, // 3
835
- __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, // 4
836
- __, __, __, __, __, __, __, __, __, __, __, __, BS , __, __, __, // 5
837
- __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, // 6
838
- __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, // 7
839
- __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, // 8
840
- __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, // 9
841
- __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, // A
842
- __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, // B
843
- __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, // C
844
- __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, // D
845
- __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, // E
846
- __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, // F
847
- ]
848
- } ;
822
+ // This is only used in IoRead. SliceRead hardcodes the arguments to memchr.
823
+ #[ cfg( feature = "std" ) ]
824
+ fn is_escape ( ch : u8 ) -> bool {
825
+ ch == b'"' || ch == b'\\' || ch < 0x20
826
+ }
849
827
850
828
fn next_or_eof < ' de , R > ( read : & mut R ) -> Result < u8 >
851
829
where
0 commit comments