File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ declare_lint! {
5757declare_lint_pass ! ( NonCamelCaseTypes => [ NON_CAMEL_CASE_TYPES ] ) ;
5858
5959fn char_has_case ( c : char ) -> bool {
60- c. is_lowercase ( ) || c. is_uppercase ( )
60+ c. to_lowercase ( ) . to_string ( ) != c. to_uppercase ( ) . to_string ( )
6161}
6262
6363fn is_camel_case ( name : & str ) -> bool {
@@ -138,6 +138,8 @@ impl NonCamelCaseTypes {
138138 to_camel_case ( name) ,
139139 Applicability :: MaybeIncorrect ,
140140 ) ;
141+ } else {
142+ err. span_label ( ident. span , "should have an UpperCamelCase name" ) ;
141143 }
142144
143145 err. emit ( ) ;
@@ -299,6 +301,8 @@ impl NonSnakeCase {
299301 } else {
300302 err. help ( & format ! ( "convert the identifier to snake case: `{}`" , sc) ) ;
301303 }
304+ } else {
305+ err. span_label ( ident. span , "should have a snake_case name" ) ;
302306 }
303307
304308 err. emit ( ) ;
@@ -477,6 +481,8 @@ impl NonUpperCaseGlobals {
477481 uc,
478482 Applicability :: MaybeIncorrect ,
479483 ) ;
484+ } else {
485+ err. span_label ( ident. span , "should have an UPPER_CASE name" ) ;
480486 }
481487
482488 err. emit ( ) ;
Original file line number Diff line number Diff line change @@ -2,29 +2,29 @@ warning: type `𝕟𝕠𝕥𝕒𝕔𝕒𝕞𝕖𝕝` should have an upper camel
22 --> $DIR/special-upper-lower-cases.rs:11:8
33 |
44LL | struct 𝕟𝕠𝕥𝕒𝕔𝕒𝕞𝕖𝕝;
5- | ^^^^^^^^^
5+ | ^^^^^^^^^ should have an UpperCamelCase name
66 |
77 = note: `#[warn(non_camel_case_types)]` on by default
88
99warning: type `𝕟𝕠𝕥_𝕒_𝕔𝕒𝕞𝕖𝕝` should have an upper camel case name
1010 --> $DIR/special-upper-lower-cases.rs:15:8
1111 |
1212LL | struct 𝕟𝕠𝕥_𝕒_𝕔𝕒𝕞𝕖𝕝;
13- | ^^^^^^^^^^^ help: convert the identifier to upper camel case: `𝕟𝕠𝕥𝕒𝕔𝕒𝕞𝕖𝕝`
13+ | ^^^^^^^^^^^ should have an UpperCamelCase name
1414
1515warning: static variable `𝗻𝗼𝗻𝘂𝗽𝗽𝗲𝗿𝗰𝗮𝘀𝗲` should have an upper case name
1616 --> $DIR/special-upper-lower-cases.rs:18:8
1717 |
1818LL | static 𝗻𝗼𝗻𝘂𝗽𝗽𝗲𝗿𝗰𝗮𝘀𝗲: i32 = 1;
19- | ^^^^^^^^^^^^
19+ | ^^^^^^^^^^^^ should have an UPPER_CASE name
2020 |
2121 = note: `#[warn(non_upper_case_globals)]` on by default
2222
2323warning: variable `𝓢𝓝𝓐𝓐𝓐𝓐𝓚𝓔𝓢` should have a snake case name
2424 --> $DIR/special-upper-lower-cases.rs:22:9
2525 |
2626LL | let 𝓢𝓝𝓐𝓐𝓐𝓐𝓚𝓔𝓢 = 1;
27- | ^^^^^^^^^
27+ | ^^^^^^^^^ should have a snake_case name
2828 |
2929 = note: `#[warn(non_snake_case)]` on by default
3030
You can’t perform that action at this time.
0 commit comments