@@ -79,7 +79,7 @@ use mem;
79
79
use option:: { None , Option , Some } ;
80
80
use result:: Result ;
81
81
use slice:: Vector ;
82
- use slice:: { ImmutableVector , MutableVector , CloneableVector } ;
82
+ use slice:: { ImmutableVector , MutableVector } ;
83
83
use string:: String ;
84
84
use vec:: Vec ;
85
85
@@ -503,7 +503,7 @@ pub fn from_utf8_lossy<'a>(v: &'a [u8]) -> MaybeOwned<'a> {
503
503
res. push_bytes ( v. slice ( subseqidx, total) )
504
504
} ;
505
505
}
506
- Owned ( res. into_owned ( ) )
506
+ Owned ( res. into_string ( ) )
507
507
}
508
508
509
509
/*
@@ -608,7 +608,7 @@ impl<'a> Str for MaybeOwned<'a> {
608
608
609
609
impl < ' a > StrAllocating for MaybeOwned < ' a > {
610
610
#[ inline]
611
- fn into_owned ( self ) -> String {
611
+ fn into_string ( self ) -> String {
612
612
match self {
613
613
Slice ( s) => s. to_string ( ) ,
614
614
Owned ( s) => s
@@ -723,18 +723,18 @@ Section: Trait implementations
723
723
/// Any string that can be represented as a slice
724
724
pub trait StrAllocating : Str {
725
725
/// Convert `self` into a `String`, not making a copy if possible.
726
- fn into_owned ( self ) -> String ;
726
+ fn into_string ( self ) -> String ;
727
727
728
728
/// Convert `self` into a `String`.
729
729
#[ inline]
730
730
fn to_string ( & self ) -> String {
731
731
String :: from_str ( self . as_slice ( ) )
732
732
}
733
733
734
- /// Convert `self` into a `String`, not making a copy if possible.
735
- #[ inline ]
736
- fn into_string ( self ) -> String {
737
- self . into_owned ( )
734
+ # [ allow ( missing_doc ) ]
735
+ #[ deprecated = "replaced by .into_string()" ]
736
+ fn into_owned ( self ) -> String {
737
+ self . into_string ( )
738
738
}
739
739
740
740
/// Escape each char in `s` with `char::escape_default`.
@@ -889,7 +889,7 @@ pub trait StrAllocating: Str {
889
889
890
890
impl < ' a > StrAllocating for & ' a str {
891
891
#[ inline]
892
- fn into_owned ( self ) -> String {
892
+ fn into_string ( self ) -> String {
893
893
self . to_string ( )
894
894
}
895
895
}
@@ -1045,7 +1045,7 @@ mod tests {
1045
1045
#[ test]
1046
1046
fn test_concat ( ) {
1047
1047
fn t ( v : & [ String ] , s : & str ) {
1048
- assert_eq ! ( v. concat( ) , s. to_str( ) . into_owned ( ) ) ;
1048
+ assert_eq ! ( v. concat( ) , s. to_str( ) . into_string ( ) ) ;
1049
1049
}
1050
1050
t ( [ "you" . to_string ( ) , "know" . to_string ( ) , "I'm" . to_string ( ) ,
1051
1051
"no" . to_string ( ) , "good" . to_string ( ) ] , "youknowI'mnogood" ) ;
@@ -1057,7 +1057,7 @@ mod tests {
1057
1057
#[ test]
1058
1058
fn test_connect ( ) {
1059
1059
fn t ( v : & [ String ] , sep : & str , s : & str ) {
1060
- assert_eq ! ( v. connect( sep) , s. to_str( ) . into_owned ( ) ) ;
1060
+ assert_eq ! ( v. connect( sep) , s. to_str( ) . into_string ( ) ) ;
1061
1061
}
1062
1062
t ( [ "you" . to_string ( ) , "know" . to_string ( ) , "I'm" . to_string ( ) ,
1063
1063
"no" . to_string ( ) , "good" . to_string ( ) ] ,
@@ -1070,7 +1070,7 @@ mod tests {
1070
1070
#[ test]
1071
1071
fn test_concat_slices ( ) {
1072
1072
fn t ( v : & [ & str ] , s : & str ) {
1073
- assert_eq ! ( v. concat( ) , s. to_str( ) . into_owned ( ) ) ;
1073
+ assert_eq ! ( v. concat( ) , s. to_str( ) . into_string ( ) ) ;
1074
1074
}
1075
1075
t ( [ "you" , "know" , "I'm" , "no" , "good" ] , "youknowI'mnogood" ) ;
1076
1076
let v: & [ & str ] = [ ] ;
@@ -1081,7 +1081,7 @@ mod tests {
1081
1081
#[ test]
1082
1082
fn test_connect_slices ( ) {
1083
1083
fn t ( v : & [ & str ] , sep : & str , s : & str ) {
1084
- assert_eq ! ( v. connect( sep) , s. to_str( ) . into_owned ( ) ) ;
1084
+ assert_eq ! ( v. connect( sep) , s. to_str( ) . into_string ( ) ) ;
1085
1085
}
1086
1086
t ( [ "you" , "know" , "I'm" , "no" , "good" ] ,
1087
1087
" " , "you know I'm no good" ) ;
@@ -2162,9 +2162,9 @@ mod tests {
2162
2162
}
2163
2163
2164
2164
#[ test]
2165
- fn test_maybe_owned_into_owned ( ) {
2166
- assert_eq ! ( Slice ( "abcde" ) . into_owned ( ) , "abcde" . to_string( ) ) ;
2167
- assert_eq ! ( Owned ( "abcde" . to_string( ) ) . into_owned ( ) , "abcde" . to_string( ) ) ;
2165
+ fn test_maybe_owned_into_string ( ) {
2166
+ assert_eq ! ( Slice ( "abcde" ) . into_string ( ) , "abcde" . to_string( ) ) ;
2167
+ assert_eq ! ( Owned ( "abcde" . to_string( ) ) . into_string ( ) , "abcde" . to_string( ) ) ;
2168
2168
}
2169
2169
2170
2170
#[ test]
0 commit comments