From 6156bc56cbd1f40e538b59ff91ce9b8d89969ff3 Mon Sep 17 00:00:00 2001 From: Kevin Cantu Date: Wed, 1 Feb 2012 03:41:58 -0800 Subject: Propagating unsafe::slice 2 --- src/libstd/fs.rs | 4 ++-- src/libstd/getopts.rs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/libstd') diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs index cbfca163c18..26a9931a0cb 100644 --- a/src/libstd/fs.rs +++ b/src/libstd/fs.rs @@ -63,7 +63,7 @@ path separators in the path then the returned path is identical to the provided path. If an empty path is provided or the path ends with a path separator then an empty path is returned. */ -fn basename(p: path) -> path { +fn basename(p: path) -> path unsafe { let i: int = str::rindex(p, os_fs::path_sep as u8); if i == -1 { i = str::rindex(p, os_fs::alt_path_sep as u8); @@ -71,7 +71,7 @@ fn basename(p: path) -> path { } let len = str::byte_len(p); if i + 1 as uint >= len { ret p; } - ret str::slice(p, i + 1 as uint, len); + ret str::unsafe::slice(p, i + 1 as uint, len); } diff --git a/src/libstd/getopts.rs b/src/libstd/getopts.rs index 585ea48725f..5510dd3231a 100644 --- a/src/libstd/getopts.rs +++ b/src/libstd/getopts.rs @@ -209,7 +209,7 @@ ok(match) - On success. Use functions such as , etc. to interrogate results. err(fail_) - On failure. Use to get an error message. */ -fn getopts(args: [str], opts: [opt]) -> result { +fn getopts(args: [str], opts: [opt]) -> result unsafe { let n_opts = vec::len::(opts); fn f(_x: uint) -> [optval] { ret []; } let vals = vec::init_fn_mut::<[optval]>(n_opts, f); @@ -229,14 +229,14 @@ fn getopts(args: [str], opts: [opt]) -> result { let names; let i_arg = option::none::; if cur[1] == '-' as u8 { - let tail = str::slice(cur, 2u, curlen); + let tail = str::unsafe::slice(cur, 2u, curlen); let eq = str::index(tail, '=' as u8); if eq == -1 { names = [long(tail)]; } else { - names = [long(str::slice(tail, 0u, eq as uint))]; + names = [long(str::unsafe::slice(tail, 0u, eq as uint))]; i_arg = - option::some::(str::slice(tail, + option::some::(str::unsafe::slice(tail, (eq as uint) + 1u, curlen - 2u)); } -- cgit 1.4.1-3-g733a5