Skip to content

Commit ad45bd3

Browse files
committed
---
yaml --- r: 129279 b: refs/heads/auto c: 9eb9fcd h: refs/heads/master i: 129277: 07faade 129275: e24a7ec 129271: acd63ab 129263: bf8653e 129247: 72d9624 129215: 3ba9a7f 129151: a74716d 129023: b904154 v: v3
1 parent 4fe749c commit ad45bd3

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
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: 673c5554437fe50d8c45f71ad8f97e769591b038
16+
refs/heads/auto: 9eb9fcd71962fae50c63431d63caab923c68182e
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/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/auto/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)