File tree 1 file changed +2
-14
lines changed
1 file changed +2
-14
lines changed Original file line number Diff line number Diff line change @@ -66,7 +66,7 @@ use core::str::pattern::Pattern;
66
66
use rustc_unicode:: char:: { decode_utf16, REPLACEMENT_CHARACTER } ;
67
67
use rustc_unicode:: str as unicode_str;
68
68
69
- use borrow:: Cow ;
69
+ use borrow:: { Cow , ToOwned } ;
70
70
use range:: RangeArgument ;
71
71
use str:: { self , FromStr , Utf8Error , Chars } ;
72
72
use vec:: Vec ;
@@ -1797,20 +1797,8 @@ impl AsRef<[u8]> for String {
1797
1797
1798
1798
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1799
1799
impl < ' a > From < & ' a str > for String {
1800
- #[ cfg( not( test) ) ]
1801
- #[ inline]
1802
1800
fn from ( s : & ' a str ) -> String {
1803
- String { vec : <[ _ ] >:: to_vec ( s. as_bytes ( ) ) }
1804
- }
1805
-
1806
- // HACK(japaric): with cfg(test) the inherent `[T]::to_vec` method, which is
1807
- // required for this method definition, is not available. Since we don't
1808
- // require this method for testing purposes, I'll just stub it
1809
- // NB see the slice::hack module in slice.rs for more information
1810
- #[ inline]
1811
- #[ cfg( test) ]
1812
- fn from ( _: & str ) -> String {
1813
- panic ! ( "not available with cfg(test)" ) ;
1801
+ s. to_owned ( )
1814
1802
}
1815
1803
}
1816
1804
You can’t perform that action at this time.
0 commit comments