File tree 2 files changed +11
-5
lines changed
2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ declare_lint! {
57
57
declare_lint_pass ! ( NonCamelCaseTypes => [ NON_CAMEL_CASE_TYPES ] ) ;
58
58
59
59
fn char_has_case ( c : char ) -> bool {
60
- c. is_lowercase ( ) || c. is_uppercase ( )
60
+ c. to_lowercase ( ) . to_string ( ) != c. to_uppercase ( ) . to_string ( )
61
61
}
62
62
63
63
fn is_camel_case ( name : & str ) -> bool {
@@ -138,6 +138,8 @@ impl NonCamelCaseTypes {
138
138
to_camel_case ( name) ,
139
139
Applicability :: MaybeIncorrect ,
140
140
) ;
141
+ } else {
142
+ err. span_label ( ident. span , "should have an UpperCamelCase name" ) ;
141
143
}
142
144
143
145
err. emit ( ) ;
@@ -299,6 +301,8 @@ impl NonSnakeCase {
299
301
} else {
300
302
err. help ( & format ! ( "convert the identifier to snake case: `{}`" , sc) ) ;
301
303
}
304
+ } else {
305
+ err. span_label ( ident. span , "should have a snake_case name" ) ;
302
306
}
303
307
304
308
err. emit ( ) ;
@@ -477,6 +481,8 @@ impl NonUpperCaseGlobals {
477
481
uc,
478
482
Applicability :: MaybeIncorrect ,
479
483
) ;
484
+ } else {
485
+ err. span_label ( ident. span , "should have an UPPER_CASE name" ) ;
480
486
}
481
487
482
488
err. emit ( ) ;
Original file line number Diff line number Diff line change @@ -2,29 +2,29 @@ warning: type `𝕟𝕠𝕥𝕒𝕔𝕒𝕞𝕖𝕝` should have an upper camel
2
2
--> $DIR/special-upper-lower-cases.rs:11:8
3
3
|
4
4
LL | struct 𝕟𝕠𝕥𝕒𝕔𝕒𝕞𝕖𝕝;
5
- | ^^^^^^^^^
5
+ | ^^^^^^^^^ should have an UpperCamelCase name
6
6
|
7
7
= note: `#[warn(non_camel_case_types)]` on by default
8
8
9
9
warning: type `𝕟𝕠𝕥_𝕒_𝕔𝕒𝕞𝕖𝕝` should have an upper camel case name
10
10
--> $DIR/special-upper-lower-cases.rs:15:8
11
11
|
12
12
LL | struct 𝕟𝕠𝕥_𝕒_𝕔𝕒𝕞𝕖𝕝;
13
- | ^^^^^^^^^^^ help: convert the identifier to upper camel case: `𝕟𝕠𝕥𝕒𝕔𝕒𝕞𝕖𝕝`
13
+ | ^^^^^^^^^^^ should have an UpperCamelCase name
14
14
15
15
warning: static variable `𝗻𝗼𝗻𝘂𝗽𝗽𝗲𝗿𝗰𝗮𝘀𝗲` should have an upper case name
16
16
--> $DIR/special-upper-lower-cases.rs:18:8
17
17
|
18
18
LL | static 𝗻𝗼𝗻𝘂𝗽𝗽𝗲𝗿𝗰𝗮𝘀𝗲: i32 = 1;
19
- | ^^^^^^^^^^^^
19
+ | ^^^^^^^^^^^^ should have an UPPER_CASE name
20
20
|
21
21
= note: `#[warn(non_upper_case_globals)]` on by default
22
22
23
23
warning: variable `𝓢𝓝𝓐𝓐𝓐𝓐𝓚𝓔𝓢` should have a snake case name
24
24
--> $DIR/special-upper-lower-cases.rs:22:9
25
25
|
26
26
LL | let 𝓢𝓝𝓐𝓐𝓐𝓐𝓚𝓔𝓢 = 1;
27
- | ^^^^^^^^^
27
+ | ^^^^^^^^^ should have a snake_case name
28
28
|
29
29
= note: `#[warn(non_snake_case)]` on by default
30
30
You can’t perform that action at this time.
0 commit comments