From 6ac4fc7fc2fb48599dbba55fcea5cfc1e6cd4602 Mon Sep 17 00:00:00 2001 From: Adolfo OchagavĂ­a Date: Thu, 10 Jul 2014 17:43:03 +0200 Subject: Deprecate `str::from_utf16` Use `String::from_utf16` instead [breaking-change] --- src/libstd/os.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/libstd') diff --git a/src/libstd/os.rs b/src/libstd/os.rs index 86577a9840d..a221dd5b376 100644 --- a/src/libstd/os.rs +++ b/src/libstd/os.rs @@ -137,7 +137,7 @@ pub fn getcwd() -> Path { fail!(); } } - Path::new(str::from_utf16(str::truncate_utf16_at_nul(buf)) + Path::new(String::from_utf16(str::truncate_utf16_at_nul(buf)) .expect("GetCurrentDirectoryW returned invalid UTF-16")) } @@ -180,7 +180,7 @@ pub mod win32 { // We want to explicitly catch the case when the // closure returned invalid UTF-16, rather than // set `res` to None and continue. - let s = str::from_utf16(sub) + let s = String::from_utf16(sub) .expect("fill_utf16_buf_and_decode: closure created invalid UTF-16"); res = option::Some(s) } @@ -1050,7 +1050,7 @@ pub fn error_string(errnum: uint) -> String { return format!("OS Error {} (FormatMessageW() returned error {})", errnum, fm_err); } - let msg = str::from_utf16(str::truncate_utf16_at_nul(buf)); + let msg = String::from_utf16(str::truncate_utf16_at_nul(buf)); match msg { Some(msg) => format!("OS Error {}: {}", errnum, msg), None => format!("OS Error {} (FormatMessageW() returned invalid UTF-16)", errnum), @@ -1207,7 +1207,7 @@ fn real_args() -> Vec { // Push it onto the list. let opt_s = slice::raw::buf_as_slice(ptr as *const _, len, |buf| { - str::from_utf16(str::truncate_utf16_at_nul(buf)) + String::from_utf16(str::truncate_utf16_at_nul(buf)) }); opt_s.expect("CommandLineToArgvW returned invalid UTF-16") }); -- cgit 1.4.1-3-g733a5