44
55// http://dev.w3.org/csswg/css3-syntax/#tokenization
66
7- use std:: { char, str, u32 , i64 , f64 } ;
7+ use std:: { char, str, num } ;
88use std:: ascii:: StrAsciiExt ;
99
1010use ast:: * ;
@@ -440,12 +440,12 @@ fn consume_numeric(tokenizer: &mut Tokenizer) -> ComponentValue {
440440 int_value : if is_integer { Some (
441441 // Remove any + sign as int::from_str() does not parse them.
442442 if representation[ 0 ] != '+' as u8 {
443- i64 :: from_str ( representation)
443+ from_str ( representation)
444444 } else {
445- i64 :: from_str ( representation. slice_from ( 1 ) )
445+ from_str ( representation. slice_from ( 1 ) )
446446 } . unwrap ( )
447447 ) } else { None } ,
448- value : f64 :: from_str ( representation) . unwrap ( ) ,
448+ value : from_str ( representation) . unwrap ( ) ,
449449 representation : representation,
450450 } ;
451451 if !tokenizer. is_eof ( ) && tokenizer. current_char ( ) == '%' {
@@ -547,10 +547,10 @@ fn consume_unicode_range(tokenizer: &mut Tokenizer) -> ComponentValue {
547547 let start;
548548 let end;
549549 if question_marks > 0 {
550- start = u32 :: from_str_radix ( hex + "0" . repeat ( question_marks) , 16 ) . unwrap ( ) ;
551- end = u32 :: from_str_radix ( hex + "F" . repeat ( question_marks) , 16 ) . unwrap ( ) ;
550+ start = num :: from_str_radix ( hex + "0" . repeat ( question_marks) , 16 ) . unwrap ( ) ;
551+ end = num :: from_str_radix ( hex + "F" . repeat ( question_marks) , 16 ) . unwrap ( ) ;
552552 } else {
553- start = u32 :: from_str_radix ( hex, 16 ) . unwrap ( ) ;
553+ start = num :: from_str_radix ( hex, 16 ) . unwrap ( ) ;
554554 hex = ~"";
555555 if !tokenizer. is_eof ( ) && tokenizer. current_char ( ) == '-' {
556556 tokenizer. position += 1 ;
@@ -563,7 +563,7 @@ fn consume_unicode_range(tokenizer: &mut Tokenizer) -> ComponentValue {
563563 }
564564 }
565565 }
566- end = if hex. len ( ) > 0 { u32 :: from_str_radix ( hex, 16 ) . unwrap ( ) } else { start }
566+ end = if hex. len ( ) > 0 { num :: from_str_radix ( hex, 16 ) . unwrap ( ) } else { start }
567567 }
568568 UnicodeRange { start : start, end : end}
569569}
@@ -594,10 +594,10 @@ fn consume_escape(tokenizer: &mut Tokenizer) -> char {
594594 }
595595 }
596596 static REPLACEMENT_CHAR : char = '\uFFFD' ;
597- let c = u32 :: from_str_radix ( hex, 16 ) . unwrap ( ) ;
597+ let c: u32 = num :: from_str_radix ( hex, 16 ) . unwrap ( ) ;
598598 if c != 0 {
599599 let c = char:: from_u32 ( c) ;
600- c. unwrap_or_default ( REPLACEMENT_CHAR )
600+ c. unwrap_or ( REPLACEMENT_CHAR )
601601 } else {
602602 REPLACEMENT_CHAR
603603 }
0 commit comments