Skip to content

Commit 1e219a1

Browse files
committed
---
yaml --- r: 133051 b: refs/heads/dist-snap c: 9eb9fcd h: refs/heads/master i: 133049: c573415 133047: d757165 v: v3
1 parent aed2fe0 commit 1e219a1

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: 457a3c991d79b971be07fce75f9d0c12848fb37c
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: 673c5554437fe50d8c45f71ad8f97e769591b038
9+
refs/heads/dist-snap: 9eb9fcd71962fae50c63431d63caab923c68182e
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/librustc/lint/builtin.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -768,9 +768,13 @@ impl LintPass for NonCamelCaseTypes {
768768
let s = token::get_ident(ident);
769769

770770
if !is_camel_case(ident) {
771-
cx.span_lint(NON_CAMEL_CASE_TYPES, span,
772-
format!("{} `{}` should have a camel case name such as `{}`",
773-
sort, s, to_camel_case(s.get())).as_slice());
771+
let c = to_camel_case(s.get());
772+
let m = if c.is_empty() {
773+
format!("{} `{}` should have a camel case name such as `CamelCase`", sort, s)
774+
} else {
775+
format!("{} `{}` should have a camel case name such as `{}`", sort, s, c)
776+
};
777+
cx.span_lint(NON_CAMEL_CASE_TYPES, span, m.as_slice());
774778
}
775779
}
776780

branches/dist-snap/src/test/compile-fail/lint-non-camel-case-types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ struct foo7 {
3737
bar: int,
3838
}
3939

40-
type __ = int; //~ ERROR type `__` should have a camel case name such as ``
40+
type __ = int; //~ ERROR type `__` should have a camel case name such as `CamelCase`
4141

4242
fn main() { }

0 commit comments

Comments
 (0)