diff options
Diffstat (limited to 'src/libstd/sys')
| -rw-r--r-- | src/libstd/sys/common/wtf8.rs | 7 | ||||
| -rw-r--r-- | src/libstd/sys/unix/os_str.rs | 5 | ||||
| -rw-r--r-- | src/libstd/sys/windows/os_str.rs | 5 |
3 files changed, 9 insertions, 8 deletions
diff --git a/src/libstd/sys/common/wtf8.rs b/src/libstd/sys/common/wtf8.rs index fb9d6fef1fa..bea2b6c6b40 100644 --- a/src/libstd/sys/common/wtf8.rs +++ b/src/libstd/sys/common/wtf8.rs @@ -38,7 +38,7 @@ use num::Int; use ops; use slice; use str; -use string::{String, CowString}; +use string::String; use sys_common::AsInner; use unicode::str::{Utf16Item, utf16_items}; use vec::Vec; @@ -530,7 +530,7 @@ impl Wtf8 { /// Surrogates are replaced with `"\u{FFFD}"` (the replacement character “�”). /// /// This only copies the data if necessary (if it contains any surrogate). - pub fn to_string_lossy(&self) -> CowString { + pub fn to_string_lossy(&self) -> Cow<str> { let surrogate_pos = match self.next_surrogate(0) { None => return Cow::Borrowed(unsafe { str::from_utf8_unchecked(&self.bytes) }), Some((pos, _)) => pos, @@ -844,7 +844,6 @@ mod tests { use borrow::Cow; use super::*; use mem::transmute; - use string::CowString; #[test] fn code_point_from_u32() { @@ -1224,7 +1223,7 @@ mod tests { assert_eq!(Wtf8::from_str("aé 💩").to_string_lossy(), Cow::Borrowed("aé 💩")); let mut string = Wtf8Buf::from_str("aé 💩"); string.push(CodePoint::from_u32(0xD800).unwrap()); - let expected: CowString = Cow::Owned(String::from_str("aé 💩�")); + let expected: Cow<str> = Cow::Owned(String::from_str("aé 💩�")); assert_eq!(string.to_string_lossy(), expected); } diff --git a/src/libstd/sys/unix/os_str.rs b/src/libstd/sys/unix/os_str.rs index 023d951dc4f..c8ac524876b 100644 --- a/src/libstd/sys/unix/os_str.rs +++ b/src/libstd/sys/unix/os_str.rs @@ -13,11 +13,12 @@ use core::prelude::*; +use borrow::Cow; use fmt::{self, Debug}; use vec::Vec; use slice::SliceExt as StdSliceExt; use str; -use string::{String, CowString}; +use string::String; use mem; #[derive(Clone, Hash)] @@ -76,7 +77,7 @@ impl Slice { str::from_utf8(&self.inner).ok() } - pub fn to_string_lossy(&self) -> CowString { + pub fn to_string_lossy(&self) -> Cow<str> { String::from_utf8_lossy(&self.inner) } diff --git a/src/libstd/sys/windows/os_str.rs b/src/libstd/sys/windows/os_str.rs index af94b56bf1f..ad1e6c4b0e7 100644 --- a/src/libstd/sys/windows/os_str.rs +++ b/src/libstd/sys/windows/os_str.rs @@ -11,9 +11,10 @@ /// The underlying OsString/OsStr implementation on Windows is a /// wrapper around the "WTF-8" encoding; see the `wtf8` module for more. +use borrow::Cow; use fmt::{self, Debug}; use sys_common::wtf8::{Wtf8, Wtf8Buf}; -use string::{String, CowString}; +use string::String; use result::Result; use option::Option; use mem; @@ -70,7 +71,7 @@ impl Slice { self.inner.as_str() } - pub fn to_string_lossy(&self) -> CowString { + pub fn to_string_lossy(&self) -> Cow<str> { self.inner.to_string_lossy() } |
