@@ -1923,7 +1923,10 @@ mod traits {
1923
1923
#[ inline]
1924
1924
fn index ( self , slice : & str ) -> & Self :: Output {
1925
1925
let ( start, end) = ( self . start , self . end ) ;
1926
- self . get ( slice) . unwrap_or_else ( || super :: slice_error_fail ( slice, start, end) )
1926
+ match self . get ( slice) {
1927
+ Some ( s) => s,
1928
+ None => super :: slice_error_fail ( slice, start, end) ,
1929
+ }
1927
1930
}
1928
1931
#[ inline]
1929
1932
fn index_mut ( self , slice : & mut str ) -> & mut Self :: Output {
@@ -1995,7 +1998,10 @@ mod traits {
1995
1998
#[ inline]
1996
1999
fn index ( self , slice : & str ) -> & Self :: Output {
1997
2000
let end = self . end ;
1998
- self . get ( slice) . unwrap_or_else ( || super :: slice_error_fail ( slice, 0 , end) )
2001
+ match self . get ( slice) {
2002
+ Some ( s) => s,
2003
+ None => super :: slice_error_fail ( slice, 0 , end) ,
2004
+ }
1999
2005
}
2000
2006
#[ inline]
2001
2007
fn index_mut ( self , slice : & mut str ) -> & mut Self :: Output {
@@ -2068,7 +2074,10 @@ mod traits {
2068
2074
#[ inline]
2069
2075
fn index ( self , slice : & str ) -> & Self :: Output {
2070
2076
let ( start, end) = ( self . start , slice. len ( ) ) ;
2071
- self . get ( slice) . unwrap_or_else ( || super :: slice_error_fail ( slice, start, end) )
2077
+ match self . get ( slice) {
2078
+ Some ( s) => s,
2079
+ None => super :: slice_error_fail ( slice, start, end) ,
2080
+ }
2072
2081
}
2073
2082
#[ inline]
2074
2083
fn index_mut ( self , slice : & mut str ) -> & mut Self :: Output {
0 commit comments