diff --git a/src/libstd/path/mod.rs b/src/libstd/path/mod.rs index 08a29f6552a..4962b63c8cf 100644 --- a/src/libstd/path/mod.rs +++ b/src/libstd/path/mod.rs @@ -179,9 +179,6 @@ pub trait GenericPath: Clone + GenericPathUnsafe { str::from_utf8_slice_opt(self.as_vec()) } - /// Converts the Path into an owned string, if possible - fn into_str(self) -> Option<~str>; - /// Returns the path as a byte vector fn as_vec<'a>(&'a self) -> &'a [u8]; diff --git a/src/libstd/path/posix.rs b/src/libstd/path/posix.rs index a7c89cb6029..5eea65a5b91 100644 --- a/src/libstd/path/posix.rs +++ b/src/libstd/path/posix.rs @@ -178,10 +178,6 @@ impl GenericPath for Path { self.repr } - fn into_str(self) -> Option<~str> { - str::from_utf8_owned_opt(self.repr) - } - fn dirname<'a>(&'a self) -> &'a [u8] { match self.sepidx { None if bytes!("..") == self.repr => self.repr.as_slice(), @@ -614,12 +610,9 @@ mod tests { assert_eq!(Path::new(b!("foo/bar")).into_vec(), b!("foo/bar").to_owned()); assert_eq!(Path::new(b!("/foo/../../bar")).into_vec(), b!("/bar").to_owned()); - assert_eq!(Path::new("foo/bar").into_str(), Some(~"foo/bar")); - assert_eq!(Path::new("/foo/../../bar").into_str(), Some(~"/bar")); let p = Path::new(b!("foo/bar", 0x80)); assert_eq!(p.as_str(), None); - assert_eq!(Path::new(b!("foo", 0xff, "/bar")).into_str(), None); } #[test] diff --git a/src/libstd/path/windows.rs b/src/libstd/path/windows.rs index 77232196f78..9576e62f439 100644 --- a/src/libstd/path/windows.rs +++ b/src/libstd/path/windows.rs @@ -327,13 +327,6 @@ impl GenericPath for Path { Some(self.repr.as_slice()) } - /// See `GenericPath::into_str` for info. - /// Always returns a `Some` value. - #[inline] - fn into_str(self) -> Option<~str> { - Some(self.repr) - } - #[inline] fn as_vec<'a>(&'a self) -> &'a [u8] { self.repr.as_bytes() @@ -1260,8 +1253,6 @@ mod tests { assert_eq!(Path::new(b!("foo\\bar")).into_vec(), b!("foo\\bar").to_owned()); assert_eq!(Path::new(b!("\\foo\\..\\..\\bar")).into_vec(), b!("\\bar").to_owned()); - assert_eq!(Path::new("foo\\bar").into_str(), Some(~"foo\\bar")); - assert_eq!(Path::new("\\foo\\..\\..\\bar").into_str(), Some(~"\\bar")); t!(s: Path::new("\\\\a"), "\\a"); t!(s: Path::new("\\\\a\\"), "\\a");