Skip to content

Conversation

catamorphism
Copy link
Contributor

No description provided.

@bors bors closed this Jul 19, 2013
flip1995 pushed a commit to flip1995/rust that referenced this pull request Nov 4, 2021
Properly consider uncased and titlecased characters.
Fixes rust-lang#7863.
flip1995 pushed a commit to flip1995/rust that referenced this pull request Nov 4, 2021
…r=xFrednet

Fix `match_str_case_mismatch` on uncased chars

False positives would result because `char::is_lowercase` and friends will return `false` for non-alphabetic chars and alphabetic chars lacking case (such as CJK scripts). Care also has to be taken for handling titlecase characters (`Dz`) and lowercased chars with no uppercase equivalent (`ʁ`).

For example, when verifying lowercase:
 * Check `!any(char::is_ascii_uppercase)` instead of `all(char::is_ascii_lowercase)` for ASCII.
 * Check that `all(|c| c.to_lowercase() == c)` instead of `all(char::is_lowercase)` for non-ASCII

Fixes rust-lang#7863.

changelog: Fix false positives in [`match_str_case_mismatch`] on uncased characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants