Skip to content

Commit 7271fe1

Browse files
committed
---
yaml --- r: 44624 b: refs/heads/master c: ae86c03 h: refs/heads/master v: v3
1 parent a6cd2b1 commit 7271fe1

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 3c0eca7940f51e267528bba537cdeb8ce9f7e506
2+
refs/heads/master: ae86c03af261fd116d53f98766fb3700435b0bc1
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a6d9689399d091c3265f00434a69c551a61c28dc
55
refs/heads/try: ef355f6332f83371e4acf04fc4eb940ab41d78d3

trunk/src/librustc/middle/lint.rs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -834,26 +834,23 @@ fn check_item_non_camel_case_types(cx: ty::ctxt, it: @ast::item) {
834834
fn is_camel_case(cx: ty::ctxt, ident: ast::ident) -> bool {
835835
let ident = cx.sess.str_of(ident);
836836
assert !ident.is_empty();
837-
let ident = ident_without_trailing_underscores(ident);
837+
let ident = ident_without_trailing_underscores(*ident);
838838
let ident = ident_without_leading_underscores(ident);
839839
char::is_uppercase(str::char_at(ident, 0)) &&
840840
!ident.contains_char('_')
841841
}
842842

843-
fn ident_without_trailing_underscores(+ident: ~str) -> ~str {
843+
fn ident_without_trailing_underscores(ident: &r/str) -> &r/str {
844844
match str::rfind(ident, |c| c != '_') {
845-
Some(idx) => (ident).slice(0, idx + 1),
846-
None => { ident } // all underscores
845+
Some(idx) => str::view(ident, 0, idx + 1),
846+
None => ident, // all underscores
847847
}
848848
}
849849

850-
fn ident_without_leading_underscores(+ident: ~str) -> ~str {
850+
fn ident_without_leading_underscores(ident: &r/str) -> &r/str {
851851
match str::find(ident, |c| c != '_') {
852-
Some(idx) => ident.slice(idx, ident.len()),
853-
None => {
854-
// all underscores
855-
ident
856-
}
852+
Some(idx) => str::view(ident, idx, ident.len()),
853+
None => ident // all underscores
857854
}
858855
}
859856

0 commit comments

Comments
 (0)