@@ -56,8 +56,19 @@ declare_lint! {
5656
5757declare_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.
5962fn char_has_case ( c : char ) -> bool {
60- c. is_lowercase ( ) || c. is_uppercase ( )
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
6374fn is_camel_case ( name : & str ) -> bool {
@@ -138,6 +149,8 @@ impl NonCamelCaseTypes {
138149 to_camel_case ( name) ,
139150 Applicability :: MaybeIncorrect ,
140151 ) ;
152+ } else {
153+ err. span_label ( ident. span , "should have an UpperCamelCase name" ) ;
141154 }
142155
143156 err. emit ( ) ;
@@ -299,6 +312,8 @@ impl NonSnakeCase {
299312 } else {
300313 err. help ( & format ! ( "convert the identifier to snake case: `{}`" , sc) ) ;
301314 }
315+ } else {
316+ err. span_label ( ident. span , "should have a snake_case name" ) ;
302317 }
303318
304319 err. emit ( ) ;
@@ -477,6 +492,8 @@ impl NonUpperCaseGlobals {
477492 uc,
478493 Applicability :: MaybeIncorrect ,
479494 ) ;
495+ } else {
496+ err. span_label ( ident. span , "should have an UPPER_CASE name" ) ;
480497 }
481498
482499 err. emit ( ) ;
0 commit comments