Skip to content

Commit d354aa3

Browse files
committed
Upgrade to rustc aa034cd3b 2014-10-03
1 parent 7b0549a commit d354aa3

File tree

5 files changed

+74
-74
lines changed

5 files changed

+74
-74
lines changed

src/color.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use ast::*;
1010

1111
#[deriving(Clone, PartialEq)]
1212
pub struct RGBA {
13-
// All in 0..1
13+
// All in 0...1
1414
// Use f32 to try and match rust-azure’s AzFloat
1515
pub red: f32,
1616
pub green: f32,
@@ -227,9 +227,9 @@ fn parse_color_hash(value: &str) -> Result<Color, ()> {
227227
($c: expr) => {{
228228
let c = $c;
229229
match c {
230-
'0' .. '9' => c as u8 - ('0' as u8),
231-
'a' .. 'f' => c as u8 - ('a' as u8) + 10,
232-
'A' .. 'F' => c as u8 - ('A' as u8) + 10,
230+
'0' ... '9' => c as u8 - ('0' as u8),
231+
'a' ... 'f' => c as u8 - ('a' as u8) + 10,
232+
'A' ... 'F' => c as u8 - ('A' as u8) + 10,
233233
_ => return Err(()) // Not a valid color
234234
}
235235
}};

src/nth.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ fn parse_end(iter: &mut Iter, a: i32, b: i32) -> Nth {
108108
fn parse_n_dash_digits(string: &str) -> Option<i32> {
109109
if string.len() >= 3
110110
&& string.starts_with("n-")
111-
&& string.slice_from(2).chars().all(|c| match c { '0'..'9' => true, _ => false })
111+
&& string.slice_from(2).chars().all(|c| match c { '0'...'9' => true, _ => false })
112112
{
113113
let result = from_str(string.slice_from(1)); // Include the minus sign
114114
assert!(result.is_some());

src/serializer.rs

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,31 @@ pub fn to_css_push(component_value: &ComponentValue, css: &mut String) {
99
match *component_value {
1010
Ident(ref value) => serialize_identifier(value.as_slice(), css),
1111
AtKeyword(ref value) => {
12-
css.push_char('@');
12+
css.push('@');
1313
serialize_identifier(value.as_slice(), css);
1414
},
1515
Hash(ref value) => {
16-
css.push_char('#');
16+
css.push('#');
1717
for c in value.as_slice().chars() {
1818
serialize_char(c, css, /* is_identifier_start = */ false);
1919
}
2020
},
2121
IDHash(ref value) => {
22-
css.push_char('#');
22+
css.push('#');
2323
serialize_identifier(value.as_slice(), css);
2424
}
2525
QuotedString(ref value) => serialize_string(value.as_slice(), css),
2626
URL(ref value) => {
2727
css.push_str("url(");
2828
serialize_string(value.as_slice(), css);
29-
css.push_char(')');
29+
css.push(')');
3030
},
31-
Delim(value) => css.push_char(value),
31+
Delim(value) => css.push(value),
3232

3333
Number(ref value) => css.push_str(value.representation.as_slice()),
3434
Percentage(ref value) => {
3535
css.push_str(value.representation.as_slice());
36-
css.push_char('%');
36+
css.push('%');
3737
},
3838
Dimension(ref value, ref unit) => {
3939
css.push_str(value.representation.as_slice());
@@ -56,10 +56,10 @@ pub fn to_css_push(component_value: &ComponentValue, css: &mut String) {
5656
}
5757
}
5858

59-
WhiteSpace => css.push_char(' '),
60-
Colon => css.push_char(':'),
61-
Semicolon => css.push_char(';'),
62-
Comma => css.push_char(','),
59+
WhiteSpace => css.push(' '),
60+
Colon => css.push(':'),
61+
Semicolon => css.push(';'),
62+
Comma => css.push(','),
6363
IncludeMatch => css.push_str("~="),
6464
DashMatch => css.push_str("|="),
6565
PrefixMatch => css.push_str("^="),
@@ -71,31 +71,31 @@ pub fn to_css_push(component_value: &ComponentValue, css: &mut String) {
7171

7272
Function(ref name, ref arguments) => {
7373
serialize_identifier(name.as_slice(), css);
74-
css.push_char('(');
74+
css.push('(');
7575
arguments.iter().to_css_push(css);
76-
css.push_char(')');
76+
css.push(')');
7777
},
7878
ParenthesisBlock(ref content) => {
79-
css.push_char('(');
79+
css.push('(');
8080
content.iter().to_css_push(css);
81-
css.push_char(')');
81+
css.push(')');
8282
},
8383
SquareBracketBlock(ref content) => {
84-
css.push_char('[');
84+
css.push('[');
8585
content.iter().to_css_push(css);
86-
css.push_char(']');
86+
css.push(']');
8787
},
8888
CurlyBracketBlock(ref content) => {
89-
css.push_char('{');
89+
css.push('{');
9090
content.iter().map(|t| match *t { (ref c, _) => c }).to_css_push(css);
91-
css.push_char('}');
91+
css.push('}');
9292
},
9393

9494
BadURL => css.push_str("url(<bad url>)"),
9595
BadString => css.push_str("\"<bad string>\n"),
96-
CloseParenthesis => css.push_char(')'),
97-
CloseSquareBracket => css.push_char(']'),
98-
CloseCurlyBracket => css.push_char('}'),
96+
CloseParenthesis => css.push(')'),
97+
CloseSquareBracket => css.push(']'),
98+
CloseCurlyBracket => css.push('}'),
9999
}
100100
}
101101

@@ -107,7 +107,7 @@ pub fn serialize_identifier(value: &str, css: &mut String) {
107107
if c == '-' {
108108
c = match iter.next() {
109109
None => { css.push_str("\\-"); return },
110-
Some(c) => { css.push_char('-'); c },
110+
Some(c) => { css.push('-'); c },
111111
}
112112
};
113113
serialize_char(c, css, /* is_identifier_start = */ true);
@@ -120,20 +120,20 @@ pub fn serialize_identifier(value: &str, css: &mut String) {
120120
#[inline]
121121
fn serialize_char(c: char, css: &mut String, is_identifier_start: bool) {
122122
match c {
123-
'0'..'9' if is_identifier_start => css.push_str(format!("\\3{} ", c).as_slice()),
123+
'0'...'9' if is_identifier_start => css.push_str(format!("\\3{} ", c).as_slice()),
124124
'-' if is_identifier_start => css.push_str("\\-"),
125-
'0'..'9' | 'A'..'Z' | 'a'..'z' | '_' | '-' => css.push_char(c),
126-
_ if c > '\x7F' => css.push_char(c),
125+
'0'...'9' | 'A'...'Z' | 'a'...'z' | '_' | '-' => css.push(c),
126+
_ if c > '\x7F' => css.push(c),
127127
'\n' => css.push_str("\\A "),
128128
'\r' => css.push_str("\\D "),
129129
'\x0C' => css.push_str("\\C "),
130-
_ => { css.push_char('\\'); css.push_char(c) },
130+
_ => { css.push('\\'); css.push(c) },
131131
}
132132
}
133133

134134

135135
pub fn serialize_string(value: &str, css: &mut String) {
136-
css.push_char('"');
136+
css.push('"');
137137
// TODO: avoid decoding/re-encoding UTF-8?
138138
for c in value.chars() {
139139
match c {
@@ -142,10 +142,10 @@ pub fn serialize_string(value: &str, css: &mut String) {
142142
'\n' => css.push_str("\\A "),
143143
'\r' => css.push_str("\\D "),
144144
'\x0C' => css.push_str("\\C "),
145-
_ => css.push_char(c),
145+
_ => css.push(c),
146146
}
147147
}
148-
css.push_char('"');
148+
css.push('"');
149149
}
150150

151151

@@ -215,7 +215,7 @@ impl<'a, I: Iterator<&'a ComponentValue>> ToCss for I {
215215
component_value.to_css_push(css);
216216
}
217217
if component_value == &Delim('\\') {
218-
css.push_char('\n');
218+
css.push('\n');
219219
}
220220
previous = component_value;
221221
}}}

src/tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ fn write_whole_file(path: &Path, data: &str) -> IoResult<()> {
2929

3030
fn print_json_diff(results: &json::Json, expected: &json::Json) -> IoResult<()> {
3131
let temp = try!(TempDir::new("rust-cssparser-tests"));
32-
let results = results.to_pretty_str().append("\n");
33-
let expected = expected.to_pretty_str().append("\n");
32+
let results = results.to_pretty_str() + "\n";
33+
let expected = expected.to_pretty_str() + "\n";
3434
let mut result_path = temp.path().clone();
3535
result_path.push("results.json");
3636
let mut expected_path = temp.path().clone();

0 commit comments

Comments
 (0)