(core::str) replace byte_index[_from] with index[_from]
This commit is contained in:
parent
280633a728
commit
6ea3d7935e
4 changed files with 23 additions and 21 deletions
|
|
@ -174,10 +174,10 @@ fn print(s: str) {
|
|||
}
|
||||
|
||||
fn rest(s: str, start: uint) -> str {
|
||||
if (start >= str::len_chars(s)) {
|
||||
if (start >= str::len_bytes(s)) {
|
||||
""
|
||||
} else {
|
||||
str::slice_chars(s, start, str::len_chars(s))
|
||||
str::slice(s, start, str::len_bytes(s))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -686,10 +686,10 @@ fn cmd_install(c: cargo) unsafe {
|
|||
|
||||
if str::starts_with(target, "uuid:") {
|
||||
let uuid = rest(target, 5u);
|
||||
alt str::index_chars(uuid, '/') {
|
||||
alt str::index(uuid, '/') {
|
||||
option::some(idx) {
|
||||
let source = str::slice_chars(uuid, 0u, idx);
|
||||
uuid = str::slice_chars(uuid, idx + 1u, str::len_chars(uuid));
|
||||
let source = str::slice(uuid, 0u, idx);
|
||||
uuid = str::slice(uuid, idx + 1u, str::len_bytes(uuid));
|
||||
install_uuid_specific(c, wd, source, uuid);
|
||||
}
|
||||
option::none {
|
||||
|
|
@ -698,10 +698,10 @@ fn cmd_install(c: cargo) unsafe {
|
|||
}
|
||||
} else {
|
||||
let name = target;
|
||||
alt str::index_chars(name, '/') {
|
||||
alt str::index(name, '/') {
|
||||
option::some(idx) {
|
||||
let source = str::slice_chars(name, 0u, idx);
|
||||
name = str::slice_chars(name, idx + 1u, str::len_chars(name));
|
||||
let source = str::slice(name, 0u, idx);
|
||||
name = str::slice(name, idx + 1u, str::len_bytes(name));
|
||||
install_named_specific(c, wd, source, name);
|
||||
}
|
||||
option::none {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue