diff --git a/src/fuzzer/fuzzer.rs b/src/fuzzer/fuzzer.rs index 152df70e7a4..bc316b6e896 100644 --- a/src/fuzzer/fuzzer.rs +++ b/src/fuzzer/fuzzer.rs @@ -286,7 +286,7 @@ fn check_variants_T( } fn last_part(filename: str) -> str { - let ix = option::get(str::rindex(filename, '/')); + let ix = option::get(str::rindex_chars(filename, '/')); str::slice(filename, ix + 1u, str::len_chars(filename) - 3u) } diff --git a/src/libcore/str.rs b/src/libcore/str.rs index 3c8cd7a3b85..30357d8ea64 100644 --- a/src/libcore/str.rs +++ b/src/libcore/str.rs @@ -72,7 +72,7 @@ export index_chars, byte_index, byte_index_from, - rindex, + rindex_chars, find, find_bytes, find_from_bytes, @@ -877,11 +877,11 @@ fn byte_index_from(s: str, b: u8, start: uint, end: uint) -> option { str::as_bytes(s) { |v| vec::position_from(v, start, end) { |x| x == b } } } -// Function: rindex +// Function: rindex_chars // // Returns the index of the first matching char // (as option some/none) -fn rindex(ss: str, cc: char) -> option { +fn rindex_chars(ss: str, cc: char) -> option { let bii = len_bytes(ss); let cii = len_chars(ss); while bii > 0u { @@ -1546,11 +1546,11 @@ mod tests { } #[test] - fn test_rindex() { - assert (rindex("hello", 'l') == some(3u)); - assert (rindex("hello", 'o') == some(4u)); - assert (rindex("hello", 'h') == some(0u)); - assert (rindex("hello", 'z') == none); + fn test_rindex_chars() { + assert (rindex_chars("hello", 'l') == some(3u)); + assert (rindex_chars("hello", 'o') == some(4u)); + assert (rindex_chars("hello", 'h') == some(0u)); + assert (rindex_chars("hello", 'z') == none); } #[test] diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs index ff218846150..3652eaf77f9 100644 --- a/src/libstd/fs.rs +++ b/src/libstd/fs.rs @@ -34,10 +34,10 @@ type path = str; fn splitDirnameBasename (pp: path) -> {dirname: str, basename: str} { let ii; - alt str::rindex(pp, os_fs::path_sep) { + alt str::rindex_chars(pp, os_fs::path_sep) { option::some(xx) { ii = xx; } option::none { - alt str::rindex(pp, os_fs::alt_path_sep) { + alt str::rindex_chars(pp, os_fs::alt_path_sep) { option::some(xx) { ii = xx; } option::none { ret {dirname: ".", basename: pp}; } }