mirror of
https://github.com/astral-sh/ruff
synced 2026-01-07 06:34:07 -05:00
Add an explicit fast path for whitespace to is_identifier_continuation (#9532)
This commit is contained in:
@@ -136,6 +136,8 @@ fn is_identifier_start(c: char) -> bool {
|
||||
// Checks if the character c is a valid continuation character as described
|
||||
// in https://docs.python.org/3/reference/lexical_analysis.html#identifiers
|
||||
fn is_identifier_continuation(c: char) -> bool {
|
||||
// Arrange things such that ASCII codepoints never
|
||||
// result in the slower `is_xid_continue` getting called.
|
||||
if c.is_ascii() {
|
||||
matches!(c, 'a'..='z' | 'A'..='Z' | '_' | '0'..='9')
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user