diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2015-03-15 05:13:52 +0530 |
|---|---|---|
| committer | Manish Goregaokar <manishsmail@gmail.com> | 2015-03-15 10:23:41 +0530 |
| commit | 7eb9c3765f123964c1ca4ac52e9f4cb60c02ce3a (patch) | |
| tree | ca857cdefdc723c0fa469ef8fb924d6decfe4ac5 | |
| parent | 01f10dead316aaff615fcff5955d1db0c7f22936 (diff) | |
| parent | 60aa7516209f50eff7fd879fc2b0e6c5d5ebb8aa (diff) | |
| download | rust-7eb9c3765f123964c1ca4ac52e9f4cb60c02ce3a.tar.gz rust-7eb9c3765f123964c1ca4ac52e9f4cb60c02ce3a.zip | |
Rollup merge of #23356 - bombless:camelcase, r=alexcrichton
non_camel_case_types lint suggests `ONETWOTHREE` for non-camel type `ONE_TWO_THREE`, which doesn't look good. This patch fixes it.
| -rw-r--r-- | src/librustc_lint/builtin.rs | 2 | ||||
| -rw-r--r-- | src/test/compile-fail/lint-non-camel-case-types.rs | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index 074591fb927..f6f82c65374 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -811,7 +811,7 @@ impl NonCamelCaseTypes { if i == 0 { c.to_uppercase().collect::<String>() } else { - c.to_string() + c.to_lowercase().collect() } )).collect::<Vec<_>>().concat() } diff --git a/src/test/compile-fail/lint-non-camel-case-types.rs b/src/test/compile-fail/lint-non-camel-case-types.rs index 9f58d5791cb..f6d3d62d0bf 100644 --- a/src/test/compile-fail/lint-non-camel-case-types.rs +++ b/src/test/compile-fail/lint-non-camel-case-types.rs @@ -11,6 +11,9 @@ #![forbid(non_camel_case_types)] #![allow(dead_code)] +struct ONE_TWO_THREE; +//~^ ERROR type `ONE_TWO_THREE` should have a camel case name such as `OneTwoThree` + struct foo { //~ ERROR type `foo` should have a camel case name such as `Foo` bar: isize, } |
