Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Rely on unicode-xid to optimize ASCII properly
  • Loading branch information
dtolnay committed Apr 6, 2022
commit affce3688f76878a16733ec0b5e4c60ef738d4e4
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ targets = ["x86_64-unknown-linux-gnu"]
features = ["span-locations"]

[dependencies]
unicode-xid = "0.2"
unicode-xid = "0.2.2"

[dev-dependencies]
quote = { version = "1.0", default_features = false }
Expand Down
11 changes: 2 additions & 9 deletions src/fallback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -666,18 +666,11 @@ impl Ident {
}

pub(crate) fn is_ident_start(c: char) -> bool {
('a' <= c && c <= 'z')
|| ('A' <= c && c <= 'Z')
|| c == '_'
|| (c > '\x7f' && UnicodeXID::is_xid_start(c))
c == '_' || UnicodeXID::is_xid_start(c)
}

pub(crate) fn is_ident_continue(c: char) -> bool {
('a' <= c && c <= 'z')
|| ('A' <= c && c <= 'Z')
|| c == '_'
|| ('0' <= c && c <= '9')
|| (c > '\x7f' && UnicodeXID::is_xid_continue(c))
UnicodeXID::is_xid_continue(c)
}

fn validate_ident(string: &str) {
Expand Down