Skip to content

Commit fd6c871

Browse files
committed
Upgrade to rustc 0.13.0-nightly (0669a432a 2014-12-15 22:11:44 +0000)
1 parent 618a80a commit fd6c871

File tree

2 files changed

+22
-11
lines changed

2 files changed

+22
-11
lines changed

src/tests.rs

+16-8
Original file line numberDiff line numberDiff line change
@@ -444,10 +444,13 @@ impl ToJson for ComponentValue {
444444
Delim('\\') => JString!("\\"),
445445
Delim(value) => Json::String(String::from_char(1, value)),
446446

447-
Number(ref value) => Json::Array(vec!(JString!("number")) + numeric(value)),
448-
Percentage(ref value) => Json::Array(vec!(JString!("percentage")) + numeric(value)),
447+
Number(ref value) => Json::Array(
448+
vec!(JString!("number")) + numeric(value).as_slice()),
449+
Percentage(ref value) => Json::Array(
450+
vec!(JString!("percentage")) + numeric(value).as_slice()),
449451
Dimension(ref value, ref unit) => Json::Array(
450-
vec!(JString!("dimension")) + numeric(value) + [unit.to_json()].as_slice()),
452+
vec!(JString!("dimension")) + numeric(value).as_slice()
453+
+ [unit.to_json()].as_slice()),
451454

452455
UnicodeRange(start, end)
453456
=> JArray!(JString!("unicode-range"), start.to_json(), end.to_json()),
@@ -466,14 +469,19 @@ impl ToJson for ComponentValue {
466469
CDC => JString!("-->"),
467470

468471
Function(ref name, ref arguments)
469-
=> Json::Array(vec!(JString!("function"), name.to_json()) +
470-
arguments.iter().map(|a| a.to_json()).collect::<Vec<json::Json>>()),
472+
=> Json::Array(
473+
vec!(JString!("function"), name.to_json())
474+
+ arguments.iter().map(|a| a.to_json()).collect::<Vec<json::Json>>().as_slice()),
471475
ParenthesisBlock(ref content)
472-
=> Json::Array(vec!(JString!("()")) + content.iter().map(|c| c.to_json()).collect::<Vec<json::Json>>()),
476+
=> Json::Array(
477+
vec!(JString!("()"))
478+
+ content.iter().map(|c| c.to_json()).collect::<Vec<json::Json>>().as_slice()),
473479
SquareBracketBlock(ref content)
474-
=> Json::Array(vec!(JString!("[]")) + content.iter().map(|c| c.to_json()).collect::<Vec<json::Json>>()),
480+
=> Json::Array(
481+
vec!(JString!("[]"))
482+
+ content.iter().map(|c| c.to_json()).collect::<Vec<json::Json>>().as_slice()),
475483
CurlyBracketBlock(ref content)
476-
=> Json::Array(vec!(JString!("{}")) + list_to_json(content)),
484+
=> Json::Array(vec!(JString!("{}")) + list_to_json(content).as_slice()),
477485

478486
BadURL => JArray!(JString!("error"), JString!("bad-url")),
479487
BadString => JArray!(JString!("error"), JString!("bad-string")),

src/tokenizer.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -554,13 +554,16 @@ fn consume_unicode_range(tokenizer: &mut Tokenizer) -> ComponentValue {
554554
question_marks += 1;
555555
tokenizer.position += 1
556556
}
557+
let first: u32 = if hex.len() > 0 {
558+
num::from_str_radix(hex.as_slice(), 16).unwrap()
559+
} else { 0 };
557560
let start;
558561
let end;
559562
if question_marks > 0 {
560-
start = num::from_str_radix((hex + "0".repeat(question_marks)).as_slice(), 16).unwrap();
561-
end = num::from_str_radix((hex + "F".repeat(question_marks)).as_slice(), 16).unwrap();
563+
start = first << (question_marks * 4);
564+
end = ((first + 1) << (question_marks * 4)) - 1;
562565
} else {
563-
start = num::from_str_radix(hex.as_slice(), 16).unwrap();
566+
start = first;
564567
hex.truncate(0);
565568
if !tokenizer.is_eof() && tokenizer.current_char() == '-' {
566569
tokenizer.position += 1;

0 commit comments

Comments
 (0)