Skip to content

Commit fa9a99f

Browse files
committed
review comments
1 parent d10ee0d commit fa9a99f

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

compiler/rustc_lint/src/nonstandard_style.rs

+12-1
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,19 @@ declare_lint! {
5656

5757
declare_lint_pass!(NonCamelCaseTypes => [NON_CAMEL_CASE_TYPES]);
5858

59+
/// Some unicode characters *have* case, are considered upper case or lower case, but they *can't*
60+
/// be upper cased or lower cased. For the purposes of the lint suggestion, we care about being able
61+
/// to change the char's case.
5962
fn char_has_case(c: char) -> bool {
60-
c.to_lowercase().to_string() != c.to_uppercase().to_string()
63+
let mut l = c.to_lowercase();
64+
let mut u = c.to_uppercase();
65+
while let Some(l) = l.next() {
66+
match u.next() {
67+
Some(u) if l != u => return true,
68+
_ => {}
69+
}
70+
}
71+
u.next().is_some()
6172
}
6273

6374
fn is_camel_case(name: &str) -> bool {

0 commit comments

Comments
 (0)