lint: make the non_camel_case_types lint work with scripts without a upper/lowercase distinction.

This commit is contained in:
Huon Wilson 2013-07-01 13:50:39 +10:00
parent 07feeb95c5
commit da4384583b

View File

@ -854,7 +854,10 @@ fn check_item_non_camel_case_types(cx: &Context, it: &ast::item) {
let ident = cx.sess.str_of(ident);
assert!(!ident.is_empty());
let ident = ident.trim_chars(&'_');
char::is_uppercase(ident.char_at(0)) &&
// start with a non-lowercase letter rather than non-uppercase
// ones (some scripts don't have a concept of upper/lowercase)
!ident.char_at(0).is_lowercase() &&
!ident.contains_char('_')
}