Skip to content

Commit 4ba2efb

Browse files
committed
---
yaml --- r: 29852 b: refs/heads/incoming c: a83414b h: refs/heads/master v: v3
1 parent f3064e7 commit 4ba2efb

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
9-
refs/heads/incoming: 74c69e1053188d92b86bc8b28cbf1af87d31ea2d
9+
refs/heads/incoming: a83414b6e8879b2485374469f7f5fe60f22ae936
1010
refs/heads/dist-snap: 2f32a1581f522e524009138b33b1c7049ced668d
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/src/rustc/middle/lint.rs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -452,17 +452,28 @@ fn check_item_path_statement(cx: ty::ctxt, it: @ast::item) {
452452
fn check_item_non_camel_case_types(cx: ty::ctxt, it: @ast::item) {
453453
fn is_camel_case(ident: ast::ident) -> bool {
454454
assert ident.is_not_empty();
455-
let ident = ident_without_trailing_underscores(ident);
455+
let ident = ident_without_trailing_underscores(*ident);
456+
let ident = ident_without_leading_underscores(ident);
456457
char::is_uppercase(str::char_at(ident, 0)) &&
457458
!ident.contains_char('_')
458459
}
459460

460-
fn ident_without_trailing_underscores(ident: ast::ident) -> ~str {
461-
match str::rfind(*ident, |c| c != '_') {
462-
some(idx) => (*ident).slice(0, idx + 1),
461+
fn ident_without_trailing_underscores(ident: ~str) -> ~str {
462+
match str::rfind(ident, |c| c != '_') {
463+
some(idx) => ident.slice(0, idx + 1),
463464
none => {
464465
// all underscores
465-
*ident
466+
ident
467+
}
468+
}
469+
}
470+
471+
fn ident_without_leading_underscores(ident: ~str) -> ~str {
472+
match str::find(ident, |c| c != '_') {
473+
some(idx) => ident.slice(idx, ident.len()),
474+
none => {
475+
// all underscores
476+
ident
466477
}
467478
}
468479
}

0 commit comments

Comments
 (0)