Skip to content

Commit e14de8c

Browse files
committed
Fix closure syntax and Sized?
1 parent 38877bc commit e14de8c

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

src/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
#![crate_name = "cssparser"]
66
#![crate_type = "rlib"]
77

8-
#![feature(globs, macro_rules, associated_types)]
9-
108
extern crate encoding;
119
extern crate text_writer;
1210

src/serializer.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use ast::*;
1010
use ast::ComponentValue::*;
1111

1212

13-
pub trait ToCss for Sized? {
13+
pub trait ToCss where Self: Sized {
1414
/// Serialize `self` in CSS syntax, writing to `dest`.
1515
fn to_css<W>(&self, dest: &mut W) -> text_writer::Result where W: TextWriter;
1616

src/tests.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ fn assert_json_eq(results: Json, expected: Json, message: String) {
7979
}
8080

8181

82-
fn run_raw_json_tests(json_data: &str, run: |Json, Json|) {
82+
fn run_raw_json_tests<F: Fn(Json, Json) -> ()>(json_data: &str, run: F) {
8383
let items = match json::from_str(json_data) {
8484
Ok(Json::Array(items)) => items,
8585
_ => panic!("Invalid JSON")
@@ -98,7 +98,7 @@ fn run_raw_json_tests(json_data: &str, run: |Json, Json|) {
9898
}
9999

100100

101-
fn run_json_tests<T: ToJson>(json_data: &str, parse: |input: &str| -> T) {
101+
fn run_json_tests<T: ToJson, F: Fn(&str) -> T>(json_data: &str, parse: F) {
102102
run_raw_json_tests(json_data, |input, expected| {
103103
match input {
104104
Json::String(input) => {
@@ -204,7 +204,7 @@ fn stylesheet_from_bytes() {
204204
}
205205

206206

207-
fn run_color_tests(json_data: &str, to_json: |result: Option<Color>| -> Json) {
207+
fn run_color_tests<F: Fn(Option<Color>) -> Json>(json_data: &str, to_json: F) {
208208
run_json_tests(json_data, |input| {
209209
match parse_one_component_value(tokenize(input)) {
210210
Ok(component_value) => to_json(Color::parse(&component_value).ok()),

0 commit comments

Comments
 (0)