@@ -92,7 +92,7 @@ fn run_json_tests<T: ToJson>(json_data: &str, parse: |input: ~str| -> T) {
92
92
#[test]
93
93
fn component_value_list() {
94
94
run_json_tests(include_str!(" css-parsing-tests/component_value_list. json"), |input| {
95
- tokenize(input).map(|(c, _)| c).to_owned_vec ()
95
+ tokenize(input).map(|(c, _)| c).collect::<~[ComponentValue]> ()
96
96
});
97
97
}
98
98
@@ -108,7 +108,7 @@ fn one_component_value() {
108
108
#[test]
109
109
fn declaration_list() {
110
110
run_json_tests(include_str!(" css-parsing-tests/declaration_list. json"), |input| {
111
- parse_declaration_list(tokenize(input)).to_owned_vec ()
111
+ parse_declaration_list(tokenize(input)).collect::<~[Result<DeclarationListItem, SyntaxError>]> ()
112
112
});
113
113
}
114
114
@@ -124,15 +124,15 @@ fn one_declaration() {
124
124
#[test]
125
125
fn rule_list() {
126
126
run_json_tests(include_str!(" css-parsing-tests/rule_list. json"), |input| {
127
- parse_rule_list(tokenize(input)).to_owned_vec ()
127
+ parse_rule_list(tokenize(input)).collect::<~[Result<Rule, SyntaxError>]> ()
128
128
});
129
129
}
130
130
131
131
132
132
#[test]
133
133
fn stylesheet() {
134
134
run_json_tests(include_str!(" css-parsing-tests/stylesheet. json"), |input| {
135
- parse_stylesheet_rules(tokenize(input)).to_owned_vec ()
135
+ parse_stylesheet_rules(tokenize(input)).collect::<~[Result<Rule, SyntaxError>]> ()
136
136
});
137
137
}
138
138
@@ -158,15 +158,15 @@ fn stylesheet_from_bytes() {
158
158
let css = get_string(map, &~" css_bytes").unwrap().chars().map(|c| {
159
159
assert!(c as u32 <= 0xFF);
160
160
c as u8
161
- }).to_owned_vec ();
161
+ }).collect::<~[u8]> ();
162
162
let protocol_encoding_label = get_string(map, &~" protocol_encoding");
163
163
let environment_encoding = get_string(map, &~" environment_encoding")
164
164
.and_then(encoding_from_whatwg_label);
165
165
166
166
let (mut rules, used_encoding) = parse_stylesheet_rules_from_bytes(
167
167
css, protocol_encoding_label, environment_encoding);
168
168
169
- (rules.to_owned_vec (), used_encoding.name().to_owned()).to_json()
169
+ (rules.collect::<~[Result<Rule, SyntaxError>]> (), used_encoding.name().to_owned()).to_json()
170
170
};
171
171
assert_json_eq(result, expected, json::Object(map).to_str());
172
172
});
@@ -242,17 +242,17 @@ fn bench_color_lookup_fail(b: &mut test::BenchHarness) {
242
242
#[test]
243
243
fn nth() {
244
244
run_json_tests(include_str!(" css-parsing-tests/An +B . json"), |input| {
245
- parse_nth(tokenize(input).map(|(c, _)| c).to_owned_vec ())
245
+ parse_nth(tokenize(input).map(|(c, _)| c).collect::<~[ComponentValue]> ())
246
246
});
247
247
}
248
248
249
249
250
250
#[test]
251
251
fn serializer() {
252
252
run_json_tests(include_str!(" css-parsing-tests/component_value_list. json"), |input| {
253
- let component_values = tokenize(input).map(|(c, _)| c).to_owned_vec ();
253
+ let component_values = tokenize(input).map(|(c, _)| c).collect::<~[ComponentValue]> ();
254
254
let serialized = component_values.iter().to_css();
255
- tokenize(serialized).map(|(c, _)| c).to_owned_vec ()
255
+ tokenize(serialized).map(|(c, _)| c).collect::<~[ComponentValue]> ()
256
256
});
257
257
}
258
258
@@ -339,11 +339,11 @@ impl ToJson for DeclarationListItem {
339
339
340
340
341
341
fn list_to_json(list: &~[(ComponentValue, SourceLocation)]) -> ~[json::Json] {
342
- list.map(|tuple| {
342
+ list.iter(). map(|tuple| {
343
343
match *tuple {
344
344
(ref c, _) => c.to_json()
345
345
}
346
- })
346
+ }).collect()
347
347
}
348
348
349
349
@@ -426,11 +426,12 @@ impl ToJson for ComponentValue {
426
426
CDC => JString(~" -->"),
427
427
428
428
Function(ref name, ref arguments)
429
- => JList(~[JString(~" function"), name.to_json()] + arguments.map(|a| a.to_json())),
429
+ => JList(~[JString(~" function"), name.to_json()] +
430
+ arguments.iter().map(|a| a.to_json()).collect::<~[json::Json]>()),
430
431
ParenthesisBlock(ref content)
431
- => JList(~[JString(~" ( ) ")] + content.map(|c| c.to_json())),
432
+ => JList(~[JString(~" ( ) ")] + content.iter(). map(|c| c.to_json()).collect::<~[json::Json]>( )),
432
433
SquareBracketBlock(ref content)
433
- => JList(~[JString(~" [ ] ")] + content.map(|c| c.to_json())),
434
+ => JList(~[JString(~" [ ] ")] + content.iter(). map(|c| c.to_json()).collect::<~[json::Json]>( )),
434
435
CurlyBracketBlock(ref content)
435
436
=> JList(~[JString(~" { } ")] + list_to_json(content)),
436
437
0 commit comments