@@ -424,7 +424,7 @@ impl<'a> Tokenizer<'a> {
424
424
chars. next ( ) ; // consume the first char
425
425
let s = self . tokenize_word ( ch, chars) ;
426
426
427
- if s. chars ( ) . all ( |x| ( '0' ..= '9' ) . contains ( & x ) || x == '.' ) {
427
+ if s. chars ( ) . all ( |x| x . is_ascii_digit ( ) || x == '.' ) {
428
428
let mut s = peeking_take_while ( & mut s. chars ( ) . peekable ( ) , |ch| {
429
429
matches ! ( ch, '0' ..='9' | '.' )
430
430
} ) ;
@@ -462,15 +462,12 @@ impl<'a> Tokenizer<'a> {
462
462
}
463
463
// numbers and period
464
464
'0' ..='9' | '.' => {
465
- let mut s = peeking_take_while ( chars, |ch| matches ! ( ch , '0' ..= '9' ) ) ;
465
+ let mut s = peeking_take_while ( chars, |ch| ch . is_ascii_digit ( ) ) ;
466
466
467
467
// match binary literal that starts with 0x
468
468
if s == "0" && chars. peek ( ) == Some ( & 'x' ) {
469
469
chars. next ( ) ;
470
- let s2 = peeking_take_while (
471
- chars,
472
- |ch| matches ! ( ch, '0' ..='9' | 'A' ..='F' | 'a' ..='f' ) ,
473
- ) ;
470
+ let s2 = peeking_take_while ( chars, |ch| ch. is_ascii_hexdigit ( ) ) ;
474
471
return Ok ( Some ( Token :: HexStringLiteral ( s2) ) ) ;
475
472
}
476
473
@@ -479,7 +476,7 @@ impl<'a> Tokenizer<'a> {
479
476
s. push ( '.' ) ;
480
477
chars. next ( ) ;
481
478
}
482
- s += & peeking_take_while ( chars, |ch| matches ! ( ch , '0' ..= '9' ) ) ;
479
+ s += & peeking_take_while ( chars, |ch| ch . is_ascii_digit ( ) ) ;
483
480
484
481
// No number -> Token::Period
485
482
if s == "." {
0 commit comments