@@ -302,6 +302,7 @@ impl String {
302
302
/// assert_eq!(String::from_utf16_lossy(v),
303
303
/// "𝄞mus\u{FFFD}ic\u{FFFD}".to_string());
304
304
/// ```
305
+ #[ inline]
305
306
#[ stable]
306
307
pub fn from_utf16_lossy ( v : & [ u16 ] ) -> String {
307
308
unicode_str:: utf16_items ( v) . map ( |c| c. to_char_lossy ( ) ) . collect ( )
@@ -556,6 +557,7 @@ impl String {
556
557
/// assert_eq!(s.remove(1), 'o');
557
558
/// assert_eq!(s.remove(0), 'o');
558
559
/// ```
560
+ #[ inline]
559
561
#[ stable]
560
562
pub fn remove ( & mut self , idx : uint ) -> char {
561
563
let len = self . len ( ) ;
@@ -582,6 +584,7 @@ impl String {
582
584
///
583
585
/// If `idx` does not lie on a character boundary or is out of bounds, then
584
586
/// this function will panic.
587
+ #[ inline]
585
588
#[ stable]
586
589
pub fn insert ( & mut self , idx : uint , ch : char ) {
587
590
let len = self . len ( ) ;
@@ -618,6 +621,7 @@ impl String {
618
621
/// }
619
622
/// assert_eq!(s.as_slice(), "olleh");
620
623
/// ```
624
+ #[ inline]
621
625
#[ stable]
622
626
pub unsafe fn as_mut_vec < ' a > ( & ' a mut self ) -> & ' a mut Vec < u8 > {
623
627
& mut self . vec
@@ -645,6 +649,7 @@ impl String {
645
649
/// v.push('a');
646
650
/// assert!(!v.is_empty());
647
651
/// ```
652
+ #[ inline]
648
653
#[ stable]
649
654
pub fn is_empty ( & self ) -> bool { self . len ( ) == 0 }
650
655
@@ -801,6 +806,7 @@ impl Str for String {
801
806
802
807
#[ stable]
803
808
impl Default for String {
809
+ #[ inline]
804
810
#[ stable]
805
811
fn default ( ) -> String {
806
812
String :: new ( )
@@ -809,13 +815,15 @@ impl Default for String {
809
815
810
816
#[ stable]
811
817
impl fmt:: String for String {
818
+ #[ inline]
812
819
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
813
820
fmt:: String :: fmt ( & * * self , f)
814
821
}
815
822
}
816
823
817
824
#[ unstable = "waiting on fmt stabilization" ]
818
825
impl fmt:: Show for String {
826
+ #[ inline]
819
827
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
820
828
fmt:: Show :: fmt ( & * * self , f)
821
829
}
@@ -842,6 +850,7 @@ impl<H: hash::Writer + hash::Hasher> hash::Hash<H> for String {
842
850
impl < ' a > Add < & ' a str > for String {
843
851
type Output = String ;
844
852
853
+ #[ inline]
845
854
fn add ( mut self , other : & str ) -> String {
846
855
self . push_str ( other) ;
847
856
self
@@ -881,6 +890,7 @@ impl ops::Index<ops::FullRange> for String {
881
890
impl ops:: Deref for String {
882
891
type Target = str ;
883
892
893
+ #[ inline]
884
894
fn deref < ' a > ( & ' a self ) -> & ' a str {
885
895
unsafe { mem:: transmute ( & self . vec [ ] ) }
886
896
}
@@ -895,6 +905,7 @@ pub struct DerefString<'a> {
895
905
impl < ' a > Deref for DerefString < ' a > {
896
906
type Target = String ;
897
907
908
+ #[ inline]
898
909
fn deref < ' b > ( & ' b self ) -> & ' b String {
899
910
unsafe { mem:: transmute ( & * self . x ) }
900
911
}
@@ -933,6 +944,7 @@ pub trait ToString {
933
944
}
934
945
935
946
impl < T : fmt:: String + ?Sized > ToString for T {
947
+ #[ inline]
936
948
fn to_string ( & self ) -> String {
937
949
use core:: fmt:: Writer ;
938
950
let mut buf = String :: new ( ) ;
@@ -943,12 +955,14 @@ impl<T: fmt::String + ?Sized> ToString for T {
943
955
}
944
956
945
957
impl IntoCow < ' static , String , str > for String {
958
+ #[ inline]
946
959
fn into_cow ( self ) -> CowString < ' static > {
947
960
Cow :: Owned ( self )
948
961
}
949
962
}
950
963
951
964
impl < ' a > IntoCow < ' a , String , str > for & ' a str {
965
+ #[ inline]
952
966
fn into_cow ( self ) -> CowString < ' a > {
953
967
Cow :: Borrowed ( self )
954
968
}
@@ -966,6 +980,7 @@ impl<'a> Str for CowString<'a> {
966
980
}
967
981
968
982
impl fmt:: Writer for String {
983
+ #[ inline]
969
984
fn write_str ( & mut self , s : & str ) -> fmt:: Result {
970
985
self . push_str ( s) ;
971
986
Ok ( ( ) )
0 commit comments