Skip to content

Commit 2143aca

Browse files
committed
Avoid struct-like enum variants.
They’re considered "unstable" enough as a language feature to be behind a flag, and probably not worth it in this case.
1 parent c27f837 commit 2143aca

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

ast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pub enum ComponentValue {
3636
Number(NumericValue),
3737
Percentage(NumericValue),
3838
Dimension(NumericValue, ~str),
39-
UnicodeRange { start: u32, end: u32 },
39+
UnicodeRange(u32, u32), // (start, end) of range
4040
WhiteSpace,
4141
Colon, // :
4242
Semicolon, // ;

lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
#[link(name = "cssparser", vers = "0.1")];
66

7-
#[feature(globs, macro_rules, struct_variant)];
7+
#[feature(globs, macro_rules)];
88

99
extern mod extra;
1010

tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,8 @@ impl ToJson for ComponentValue {
325325
Dimension(ref value, ref unit)
326326
=> JList(~[JString(~"dimension")] + numeric(value) + ~[unit.to_json()]),
327327
328-
UnicodeRange { start: s, end: e }
329-
=> JList(~[JString(~"unicode-range"), s.to_json(), e.to_json()]),
328+
UnicodeRange(start, end)
329+
=> JList(~[JString(~"unicode-range"), start.to_json(), end.to_json()]),
330330
331331
WhiteSpace => JString(~" "),
332332
Colon => JString(~":"),

tokenizer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ fn consume_unicode_range(tokenizer: &mut Tokenizer) -> ComponentValue {
565565
}
566566
end = if hex.len() > 0 { num::from_str_radix(hex, 16).unwrap() } else { start }
567567
}
568-
UnicodeRange {start: start, end: end}
568+
UnicodeRange(start, end)
569569
}
570570

571571

0 commit comments

Comments
 (0)