Skip to content

Commit affce36

Browse files
committed
Rely on unicode-xid to optimize ASCII properly
1 parent 1bbc8b1 commit affce36

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ targets = ["x86_64-unknown-linux-gnu"]
2525
features = ["span-locations"]
2626

2727
[dependencies]
28-
unicode-xid = "0.2"
28+
unicode-xid = "0.2.2"
2929

3030
[dev-dependencies]
3131
quote = { version = "1.0", default_features = false }

src/fallback.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -666,18 +666,11 @@ impl Ident {
666666
}
667667

668668
pub(crate) fn is_ident_start(c: char) -> bool {
669-
('a' <= c && c <= 'z')
670-
|| ('A' <= c && c <= 'Z')
671-
|| c == '_'
672-
|| (c > '\x7f' && UnicodeXID::is_xid_start(c))
669+
c == '_' || UnicodeXID::is_xid_start(c)
673670
}
674671

675672
pub(crate) fn is_ident_continue(c: char) -> bool {
676-
('a' <= c && c <= 'z')
677-
|| ('A' <= c && c <= 'Z')
678-
|| c == '_'
679-
|| ('0' <= c && c <= '9')
680-
|| (c > '\x7f' && UnicodeXID::is_xid_continue(c))
673+
UnicodeXID::is_xid_continue(c)
681674
}
682675

683676
fn validate_ident(string: &str) {

0 commit comments

Comments
 (0)