Skip to content

Commit

Permalink
Showing 2 changed files with 9 additions and 8 deletions.
5 changes: 3 additions & 2 deletions src/rustc/middle/lint.rs
Original file line number Diff line number Diff line change
@@ -156,7 +156,7 @@ fn get_lint_dict() -> lint_dict {

(~"non_camel_case_types",
@{lint: non_camel_case_types,
desc: ~"types, variants and traits must have camel case names",
desc: ~"types, variants and traits should have camel case names",
default: warn}),

(~"managed_heap_memory",
@@ -605,7 +605,8 @@ fn check_item_non_camel_case_types(cx: ty::ctxt, it: @ast::item) {
if !is_camel_case(cx, ident) {
cx.sess.span_lint(
non_camel_case_types, expr_id, item_id, span,
~"type, variant, or trait must be camel case");
~"type, variant, or trait should have \
a camel case identifier");
}
}

12 changes: 6 additions & 6 deletions src/test/compile-fail/lint-non-camel-case-types.rs
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
#[forbid(non_camel_case_types)];

struct foo { //~ ERROR type, variant, or trait must be camel case
struct foo { //~ ERROR type, variant, or trait should have a camel case identifier
bar: int,
}

enum foo2 { //~ ERROR type, variant, or trait must be camel case
enum foo2 { //~ ERROR type, variant, or trait should have a camel case identifier
Bar
}

struct foo3 { //~ ERROR type, variant, or trait must be camel case
struct foo3 { //~ ERROR type, variant, or trait should have a camel case identifier
bar: int
}

type foo4 = int; //~ ERROR type, variant, or trait must be camel case
type foo4 = int; //~ ERROR type, variant, or trait should have a camel case identifier

enum Foo5 {
bar //~ ERROR type, variant, or trait must be camel case
bar //~ ERROR type, variant, or trait should have a camel case identifier
}

trait foo6 { //~ ERROR type, variant, or trait must be camel case
trait foo6 { //~ ERROR type, variant, or trait should have a camel case identifier
}

fn main() { }

0 comments on commit eb35039

Please sign in to comment.