From 60aa7516209f50eff7fd879fc2b0e6c5d5ebb8aa Mon Sep 17 00:00:00 2001 From: York Xiang Date: Sat, 14 Mar 2015 13:40:33 +0800 Subject: [PATCH] Improve camelcase suggestion --- src/librustc_lint/builtin.rs | 2 +- src/test/compile-fail/lint-non-camel-case-types.rs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) 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::() } else { - c.to_string() + c.to_lowercase().collect() } )).collect::>().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, }