4
4
5
5
// http://dev.w3.org/csswg/css3-syntax/#tokenization
6
6
7
- use std:: { char, str, u32 , i64 , f64 } ;
7
+ use std:: { char, str, num } ;
8
8
use std:: ascii:: StrAsciiExt ;
9
9
10
10
use ast:: * ;
@@ -440,12 +440,12 @@ fn consume_numeric(tokenizer: &mut Tokenizer) -> ComponentValue {
440
440
int_value : if is_integer { Some (
441
441
// Remove any + sign as int::from_str() does not parse them.
442
442
if representation[ 0 ] != '+' as u8 {
443
- i64 :: from_str ( representation)
443
+ from_str ( representation)
444
444
} else {
445
- i64 :: from_str ( representation. slice_from ( 1 ) )
445
+ from_str ( representation. slice_from ( 1 ) )
446
446
} . unwrap ( )
447
447
) } else { None } ,
448
- value : f64 :: from_str ( representation) . unwrap ( ) ,
448
+ value : from_str ( representation) . unwrap ( ) ,
449
449
representation : representation,
450
450
} ;
451
451
if !tokenizer. is_eof ( ) && tokenizer. current_char ( ) == '%' {
@@ -547,10 +547,10 @@ fn consume_unicode_range(tokenizer: &mut Tokenizer) -> ComponentValue {
547
547
let start;
548
548
let end;
549
549
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 ( ) ;
552
552
} else {
553
- start = u32 :: from_str_radix ( hex, 16 ) . unwrap ( ) ;
553
+ start = num :: from_str_radix ( hex, 16 ) . unwrap ( ) ;
554
554
hex = ~"";
555
555
if !tokenizer. is_eof ( ) && tokenizer. current_char ( ) == '-' {
556
556
tokenizer. position += 1 ;
@@ -563,7 +563,7 @@ fn consume_unicode_range(tokenizer: &mut Tokenizer) -> ComponentValue {
563
563
}
564
564
}
565
565
}
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 }
567
567
}
568
568
UnicodeRange { start : start, end : end}
569
569
}
@@ -594,10 +594,10 @@ fn consume_escape(tokenizer: &mut Tokenizer) -> char {
594
594
}
595
595
}
596
596
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 ( ) ;
598
598
if c != 0 {
599
599
let c = char:: from_u32 ( c) ;
600
- c. unwrap_or_default ( REPLACEMENT_CHAR )
600
+ c. unwrap_or ( REPLACEMENT_CHAR )
601
601
} else {
602
602
REPLACEMENT_CHAR
603
603
}
0 commit comments