@@ -495,11 +495,13 @@ impl OsStr {
495
495
///
496
496
/// let os_str = OsStr::new("foo");
497
497
/// ```
498
+ #[ inline]
498
499
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
499
500
pub fn new < S : AsRef < OsStr > + ?Sized > ( s : & S ) -> & OsStr {
500
501
s. as_ref ( )
501
502
}
502
503
504
+ #[ inline]
503
505
fn from_inner ( inner : & Slice ) -> & OsStr {
504
506
unsafe { & * ( inner as * const Slice as * const OsStr ) }
505
507
}
@@ -658,6 +660,7 @@ impl OsStr {
658
660
///
659
661
/// Note: it is *crucial* that this API is private, to avoid
660
662
/// revealing the internal, platform-specific encodings.
663
+ #[ inline]
661
664
fn bytes ( & self ) -> & [ u8 ] {
662
665
unsafe { & * ( & self . inner as * const _ as * const [ u8 ] ) }
663
666
}
@@ -797,20 +800,23 @@ impl Default for &OsStr {
797
800
798
801
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
799
802
impl PartialEq for OsStr {
803
+ #[ inline]
800
804
fn eq ( & self , other : & OsStr ) -> bool {
801
805
self . bytes ( ) . eq ( other. bytes ( ) )
802
806
}
803
807
}
804
808
805
809
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
806
810
impl PartialEq < str > for OsStr {
811
+ #[ inline]
807
812
fn eq ( & self , other : & str ) -> bool {
808
813
* self == * OsStr :: new ( other)
809
814
}
810
815
}
811
816
812
817
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
813
818
impl PartialEq < OsStr > for str {
819
+ #[ inline]
814
820
fn eq ( & self , other : & OsStr ) -> bool {
815
821
* other == * OsStr :: new ( self )
816
822
}
@@ -944,13 +950,15 @@ impl AsRef<OsStr> for OsString {
944
950
945
951
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
946
952
impl AsRef < OsStr > for str {
953
+ #[ inline]
947
954
fn as_ref ( & self ) -> & OsStr {
948
955
OsStr :: from_inner ( Slice :: from_str ( self ) )
949
956
}
950
957
}
951
958
952
959
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
953
960
impl AsRef < OsStr > for String {
961
+ #[ inline]
954
962
fn as_ref ( & self ) -> & OsStr {
955
963
( & * * self ) . as_ref ( )
956
964
}
0 commit comments