diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index c1e093436c3..b5ed7e6a077 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -802,6 +802,12 @@ fn from_str(s: &str) -> Option { } } +/// Trait for converting a type to a string, consuming it in the process. +pub trait IntoString { + /// Consume and convert to a string. + fn into_string(self) -> String; +} + /// Unsafe operations #[unstable = "waiting on raw module conventions"] pub mod raw { diff --git a/src/libstd/ascii.rs b/src/libstd/ascii.rs index 56b048c3187..923349b1bf7 100644 --- a/src/libstd/ascii.rs +++ b/src/libstd/ascii.rs @@ -21,8 +21,7 @@ use option::{Option, Some, None}; use slice::{SlicePrelude, AsSlice}; use str::{Str, StrPrelude}; -use string::{mod, String}; -use to_string::IntoString; +use string::{mod, String, IntoString}; use vec::Vec; /// Datatype to hold one ascii character. It wraps a `u8`, with the highest bit always zero. diff --git a/src/libstd/prelude.rs b/src/libstd/prelude.rs index 47dd07081d0..a75c51b9f9f 100644 --- a/src/libstd/prelude.rs +++ b/src/libstd/prelude.rs @@ -76,14 +76,14 @@ #[doc(no_inline)] pub use io::{Buffer, Writer, Reader, Seek}; #[doc(no_inline)] pub use str::{Str, StrVector, StrPrelude}; #[doc(no_inline)] pub use str::{IntoMaybeOwned, StrAllocating, UnicodeStrPrelude}; -#[doc(no_inline)] pub use to_string::{ToString, IntoString}; +#[doc(no_inline)] pub use to_string::ToString; #[doc(no_inline)] pub use tuple::{Tuple1, Tuple2, Tuple3, Tuple4}; #[doc(no_inline)] pub use tuple::{Tuple5, Tuple6, Tuple7, Tuple8}; #[doc(no_inline)] pub use tuple::{Tuple9, Tuple10, Tuple11, Tuple12}; #[doc(no_inline)] pub use slice::{SlicePrelude, AsSlice, CloneSlicePrelude}; #[doc(no_inline)] pub use slice::{VectorVector, PartialEqSlicePrelude, OrdSlicePrelude}; #[doc(no_inline)] pub use slice::{CloneSliceAllocPrelude, OrdSliceAllocPrelude, SliceAllocPrelude}; -#[doc(no_inline)] pub use string::String; +#[doc(no_inline)] pub use string::{IntoString, String}; #[doc(no_inline)] pub use vec::Vec; // Reexported runtime types diff --git a/src/libstd/to_string.rs b/src/libstd/to_string.rs index 737e467f19c..327410b320d 100644 --- a/src/libstd/to_string.rs +++ b/src/libstd/to_string.rs @@ -25,12 +25,6 @@ pub trait ToString { fn to_string(&self) -> String; } -/// Trait for converting a type to a string, consuming it in the process. -pub trait IntoString { - /// Consume and convert to a string. - fn into_string(self) -> String; -} - impl ToString for T { fn to_string(&self) -> String { format!("{}", *self)