about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/ascii.rs14
-rw-r--r--src/libstd/os.rs14
-rw-r--r--src/libstd/sys/unix/os.rs2
3 files changed, 14 insertions, 16 deletions
diff --git a/src/libstd/ascii.rs b/src/libstd/ascii.rs
index 933794cb5a4..47189ba84ed 100644
--- a/src/libstd/ascii.rs
+++ b/src/libstd/ascii.rs
@@ -21,7 +21,7 @@ use mem;
 use option::{Option, Some, None};
 use slice::{SlicePrelude, AsSlice};
 use str::{Str, StrPrelude};
-use string::{mod, String, IntoString};
+use string::{String, IntoString};
 use vec::Vec;
 
 /// Datatype to hold one ascii character. It wraps a `u8`, with the highest bit always zero.
@@ -331,9 +331,7 @@ impl AsciiStr for [Ascii] {
 impl IntoString for Vec<Ascii> {
     #[inline]
     fn into_string(self) -> String {
-        unsafe {
-            string::raw::from_utf8(self.into_bytes())
-        }
+        unsafe { String::from_utf8_unchecked(self.into_bytes()) }
     }
 }
 
@@ -394,13 +392,13 @@ impl AsciiExt<String> for str {
     #[inline]
     fn to_ascii_upper(&self) -> String {
         // Vec<u8>::to_ascii_upper() preserves the UTF-8 invariant.
-        unsafe { string::raw::from_utf8(self.as_bytes().to_ascii_upper()) }
+        unsafe { String::from_utf8_unchecked(self.as_bytes().to_ascii_upper()) }
     }
 
     #[inline]
     fn to_ascii_lower(&self) -> String {
         // Vec<u8>::to_ascii_lower() preserves the UTF-8 invariant.
-        unsafe { string::raw::from_utf8(self.as_bytes().to_ascii_lower()) }
+        unsafe { String::from_utf8_unchecked(self.as_bytes().to_ascii_lower()) }
     }
 
     #[inline]
@@ -413,13 +411,13 @@ impl OwnedAsciiExt for String {
     #[inline]
     fn into_ascii_upper(self) -> String {
         // Vec<u8>::into_ascii_upper() preserves the UTF-8 invariant.
-        unsafe { string::raw::from_utf8(self.into_bytes().into_ascii_upper()) }
+        unsafe { String::from_utf8_unchecked(self.into_bytes().into_ascii_upper()) }
     }
 
     #[inline]
     fn into_ascii_lower(self) -> String {
         // Vec<u8>::into_ascii_lower() preserves the UTF-8 invariant.
-        unsafe { string::raw::from_utf8(self.into_bytes().into_ascii_lower()) }
+        unsafe { String::from_utf8_unchecked(self.into_bytes().into_ascii_lower()) }
     }
 }
 
diff --git a/src/libstd/os.rs b/src/libstd/os.rs
index d7ba4877086..b3591cd6408 100644
--- a/src/libstd/os.rs
+++ b/src/libstd/os.rs
@@ -248,7 +248,7 @@ pub fn env_as_bytes() -> Vec<(Vec<u8>,Vec<u8>)> {
     unsafe {
         #[cfg(windows)]
         unsafe fn get_env_pairs() -> Vec<Vec<u8>> {
-            use slice::raw;
+            use slice;
 
             use libc::funcs::extra::kernel32::{
                 GetEnvironmentStringsW,
@@ -281,9 +281,9 @@ pub fn env_as_bytes() -> Vec<(Vec<u8>,Vec<u8>)> {
                 while *(p as *const _).offset(len) != 0 {
                     len += 1;
                 }
-                raw::buf_as_slice(p, len as uint, |s| {
-                    result.push(String::from_utf16_lossy(s).into_bytes());
-                });
+                let p = p as *const u16;
+                let s = slice::from_raw_buf(&p, len as uint);
+                result.push(String::from_utf16_lossy(s).into_bytes());
                 i += len as int + 1;
             }
             FreeEnvironmentStringsW(ch);
@@ -1071,9 +1071,9 @@ fn real_args() -> Vec<String> {
         while *ptr.offset(len as int) != 0 { len += 1; }
 
         // Push it onto the list.
-        let opt_s = slice::raw::buf_as_slice(ptr as *const _, len, |buf| {
-            String::from_utf16(::str::truncate_utf16_at_nul(buf))
-        });
+        let ptr = ptr as *const u16;
+        let buf = slice::from_raw_buf(&ptr, len);
+        let opt_s = String::from_utf16(::str::truncate_utf16_at_nul(buf));
         opt_s.expect("CommandLineToArgvW returned invalid UTF-16")
     });
 
diff --git a/src/libstd/sys/unix/os.rs b/src/libstd/sys/unix/os.rs
index 4e495f043bc..d951977fa59 100644
--- a/src/libstd/sys/unix/os.rs
+++ b/src/libstd/sys/unix/os.rs
@@ -98,7 +98,7 @@ pub fn error_string(errno: i32) -> String {
             panic!("strerror_r failure");
         }
 
-        ::string::raw::from_buf(p as *const u8)
+        String::from_raw_buf(p as *const u8)
     }
 }