This repository was archived by the owner on May 28, 2025. It is now read-only.
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]> {
3636 }
3737
3838 /// 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 {
4040 debug_assert ! ( self . as_ref( ) . len( ) >= u. len( ) ) ;
4141 let iter = self . as_ref ( ) . iter ( ) . zip ( u. iter ( ) ) ;
4242 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> {
207207/// Parse a partial representation of a special, non-finite float.
208208fn parse_partial_inf_nan < F : RawFloat > ( s : & [ u8 ] ) -> Option < ( F , usize ) > {
209209 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 }
211211 }
212212 if s. len ( ) >= 3 {
213- if s. eq_ignore_case ( b"nan" ) {
213+ if s. starts_with_ignore_case ( b"nan" ) {
214214 return Some ( ( F :: NAN , 3 ) ) ;
215- } else if s. eq_ignore_case ( b"inf" ) {
215+ } else if s. starts_with_ignore_case ( b"inf" ) {
216216 return Some ( ( F :: INFINITY , parse_inf_rest ( s) ) ) ;
217217 }
218218 }
You can’t perform that action at this time.
0 commit comments