Skip to content

Commit 969fdf4

Browse files
killerswanmarijnh
authored andcommitted
(core::str) rename index -> index_chars
1 parent 8ea9616 commit 969fdf4

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

src/cargo/cargo.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@ fn cmd_install(c: cargo) unsafe {
686686

687687
if str::starts_with(target, "uuid:") {
688688
let uuid = rest(target, 5u);
689-
alt str::index(uuid, '/') {
689+
alt str::index_chars(uuid, '/') {
690690
option::some(idx) {
691691
let source = str::slice(uuid, 0u, idx);
692692
uuid = str::slice(uuid, idx + 1u, str::len_chars(uuid));
@@ -698,7 +698,7 @@ fn cmd_install(c: cargo) unsafe {
698698
}
699699
} else {
700700
let name = target;
701-
alt str::index(name, '/') {
701+
alt str::index_chars(name, '/') {
702702
option::some(idx) {
703703
let source = str::slice(name, 0u, idx);
704704
name = str::slice(name, idx + 1u, str::len_chars(name));

src/comp/back/link.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ mod write {
109109
// Decides what to call an intermediate file, given the name of the output
110110
// and the extension to use.
111111
fn mk_intermediate_name(output_path: str, extension: str) -> str unsafe {
112-
let stem = alt str::index(output_path, '.') {
112+
let stem = alt str::index_chars(output_path, '.') {
113113
option::some(dot_pos) {
114114
str::slice(output_path, 0u, dot_pos)
115115
}

src/libcore/str.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export
6969
lines_iter,
7070

7171
// Searching
72-
index,
72+
index_chars,
7373
byte_index,
7474
byte_index_from,
7575
rindex,
@@ -838,7 +838,7 @@ Section: Searching
838838
//
839839
// Returns the index of the first matching char
840840
// (as option some/none)
841-
fn index(ss: str, cc: char) -> option<uint> {
841+
fn index_chars(ss: str, cc: char) -> option<uint> {
842842
let bii = 0u;
843843
let cii = 0u;
844844
let len = len_bytes(ss);
@@ -1157,8 +1157,6 @@ Safety note:
11571157
11581158
This function fails if `byte_offset` or `char_len` do not represent
11591159
valid positions in `s`
1160-
1161-
FIXME: rename to 'substr_len_bytes'
11621160
*/
11631161
fn substr_len_bytes(s: str, byte_offset: uint, char_len: uint) -> uint {
11641162
let i = byte_offset;
@@ -1540,11 +1538,11 @@ mod tests {
15401538
}
15411539

15421540
#[test]
1543-
fn test_index() {
1544-
assert ( index("hello", 'h') == some(0u));
1545-
assert ( index("hello", 'e') == some(1u));
1546-
assert ( index("hello", 'o') == some(4u));
1547-
assert ( index("hello", 'z') == none);
1541+
fn test_index_chars() {
1542+
assert ( index_chars("hello", 'h') == some(0u));
1543+
assert ( index_chars("hello", 'e') == some(1u));
1544+
assert ( index_chars("hello", 'o') == some(4u));
1545+
assert ( index_chars("hello", 'z') == none);
15481546
}
15491547

15501548
#[test]

0 commit comments

Comments
 (0)