File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed
library/core/src/num/dec2flt Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ pub(crate) trait ByteSlice: AsRef<[u8]> {
36
36
}
37
37
38
38
/// Check if self starts with u with a case-insensitive comparison.
39
- fn eq_ignore_case ( & self , u : & [ u8 ] ) -> bool {
39
+ fn starts_with_ignore_case ( & self , u : & [ u8 ] ) -> bool {
40
40
debug_assert ! ( self . as_ref( ) . len( ) >= u. len( ) ) ;
41
41
let iter = self . as_ref ( ) . iter ( ) . zip ( u. iter ( ) ) ;
42
42
let d = iter. fold ( 0 , |i, ( & x, & y) | i | ( x ^ y) ) ;
Original file line number Diff line number Diff line change @@ -207,12 +207,12 @@ pub fn parse_number(s: &[u8], negative: bool) -> Option<Number> {
207
207
/// Parse a partial representation of a special, non-finite float.
208
208
fn parse_partial_inf_nan < F : RawFloat > ( s : & [ u8 ] ) -> Option < ( F , usize ) > {
209
209
fn parse_inf_rest ( s : & [ u8 ] ) -> usize {
210
- if s. len ( ) >= 8 && s[ 3 ..] . as_ref ( ) . eq_ignore_case ( b"inity" ) { 8 } else { 3 }
210
+ if s. len ( ) >= 8 && s[ 3 ..] . as_ref ( ) . starts_with_ignore_case ( b"inity" ) { 8 } else { 3 }
211
211
}
212
212
if s. len ( ) >= 3 {
213
- if s. eq_ignore_case ( b"nan" ) {
213
+ if s. starts_with_ignore_case ( b"nan" ) {
214
214
return Some ( ( F :: NAN , 3 ) ) ;
215
- } else if s. eq_ignore_case ( b"inf" ) {
215
+ } else if s. starts_with_ignore_case ( b"inf" ) {
216
216
return Some ( ( F :: INFINITY , parse_inf_rest ( s) ) ) ;
217
217
}
218
218
}
You can’t perform that action at this time.
0 commit comments