review comments
This commit is contained in:
parent
d10ee0d07e
commit
fa9a99fefc
1 changed files with 12 additions and 1 deletions
|
@ -56,8 +56,19 @@ declare_lint! {
|
||||||
|
|
||||||
declare_lint_pass!(NonCamelCaseTypes => [NON_CAMEL_CASE_TYPES]);
|
declare_lint_pass!(NonCamelCaseTypes => [NON_CAMEL_CASE_TYPES]);
|
||||||
|
|
||||||
|
/// Some unicode characters *have* case, are considered upper case or lower case, but they *can't*
|
||||||
|
/// be upper cased or lower cased. For the purposes of the lint suggestion, we care about being able
|
||||||
|
/// to change the char's case.
|
||||||
fn char_has_case(c: char) -> bool {
|
fn char_has_case(c: char) -> bool {
|
||||||
c.to_lowercase().to_string() != c.to_uppercase().to_string()
|
let mut l = c.to_lowercase();
|
||||||
|
let mut u = c.to_uppercase();
|
||||||
|
while let Some(l) = l.next() {
|
||||||
|
match u.next() {
|
||||||
|
Some(u) if l != u => return true,
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
u.next().is_some()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_camel_case(name: &str) -> bool {
|
fn is_camel_case(name: &str) -> bool {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue