Skip to content

Commit 59abf75

Browse files
committed
Move IntoString to collections::string
1 parent 2d8ca04 commit 59abf75

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
lines changed

src/libcollections/string.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -802,6 +802,12 @@ impl FromStr for String {
802802
}
803803
}
804804

805+
/// Trait for converting a type to a string, consuming it in the process.
806+
pub trait IntoString {
807+
/// Consume and convert to a string.
808+
fn into_string(self) -> String;
809+
}
810+
805811
/// Unsafe operations
806812
#[unstable = "waiting on raw module conventions"]
807813
pub mod raw {

src/libstd/ascii.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ use mem;
2121
use option::{Option, Some, None};
2222
use slice::{SlicePrelude, AsSlice};
2323
use str::{Str, StrPrelude};
24-
use string::{mod, String};
25-
use to_string::IntoString;
24+
use string::{mod, String, IntoString};
2625
use vec::Vec;
2726

2827
/// Datatype to hold one ascii character. It wraps a `u8`, with the highest bit always zero.

src/libstd/prelude.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,14 @@
7676
#[doc(no_inline)] pub use io::{Buffer, Writer, Reader, Seek};
7777
#[doc(no_inline)] pub use str::{Str, StrVector, StrPrelude};
7878
#[doc(no_inline)] pub use str::{IntoMaybeOwned, StrAllocating, UnicodeStrPrelude};
79-
#[doc(no_inline)] pub use to_string::{ToString, IntoString};
79+
#[doc(no_inline)] pub use to_string::ToString;
8080
#[doc(no_inline)] pub use tuple::{Tuple1, Tuple2, Tuple3, Tuple4};
8181
#[doc(no_inline)] pub use tuple::{Tuple5, Tuple6, Tuple7, Tuple8};
8282
#[doc(no_inline)] pub use tuple::{Tuple9, Tuple10, Tuple11, Tuple12};
8383
#[doc(no_inline)] pub use slice::{SlicePrelude, AsSlice, CloneSlicePrelude};
8484
#[doc(no_inline)] pub use slice::{VectorVector, PartialEqSlicePrelude, OrdSlicePrelude};
8585
#[doc(no_inline)] pub use slice::{CloneSliceAllocPrelude, OrdSliceAllocPrelude, SliceAllocPrelude};
86-
#[doc(no_inline)] pub use string::String;
86+
#[doc(no_inline)] pub use string::{IntoString, String};
8787
#[doc(no_inline)] pub use vec::Vec;
8888

8989
// Reexported runtime types

src/libstd/to_string.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,6 @@ pub trait ToString {
2525
fn to_string(&self) -> String;
2626
}
2727

28-
/// Trait for converting a type to a string, consuming it in the process.
29-
pub trait IntoString {
30-
/// Consume and convert to a string.
31-
fn into_string(self) -> String;
32-
}
33-
3428
impl<T: fmt::Show> ToString for T {
3529
fn to_string(&self) -> String {
3630
format!("{}", *self)

0 commit comments

Comments
 (0)