aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-11-22 11:23:35 -0600
committerAlex Crichton <alex@alexcrichton.com>2014-11-22 11:23:35 -0600
commit1e35b001094b20d2452adff305e418591d4000fb (patch)
treec724ca5e48ae25b2fb7f5f853262c21f3e4de562
parent3dfa68dc449c8bb8716fa77998b1360dc216f2a2 (diff)
parentc7872d82fcea1fc1f22f9b462a6a7af01f881221 (diff)
downloadmilf-rs-1e35b001094b20d2452adff305e418591d4000fb.tar.gz
milf-rs-1e35b001094b20d2452adff305e418591d4000fb.zip
Merge pull request #33 from markuskobler/master
Fixing build errors with latest rust
-rw-r--r--src/parser.rs40
-rw-r--r--src/test/valid.rs2
2 files changed, 23 insertions, 19 deletions
diff --git a/src/parser.rs b/src/parser.rs
index 69549e7..9db2cc9 100644
--- a/src/parser.rs
+++ b/src/parser.rs
@@ -257,7 +257,7 @@ impl<'a> Parser<'a> {
Some((pos, 'f')) => self.boolean(pos),
Some((pos, '[')) => self.array(pos),
Some((pos, '-')) => self.number_or_datetime(pos),
- Some((pos, ch)) if ch.is_digit() => self.number_or_datetime(pos),
+ Some((pos, ch)) if ch.is_digit(10) => self.number_or_datetime(pos),
_ => {
let mut it = self.cur.clone();
let lo = it.next().map(|p| p.val0()).unwrap_or(self.input.len());
@@ -309,7 +309,9 @@ impl<'a> Parser<'a> {
Some((_, '\r')) if multiline => ret.push('\n'),
Some((pos, ch)) if ch < '\u001f' => {
let mut escaped = String::new();
- ch.escape_default(|c| escaped.push(c));
+ for c in ch.escape_default() {
+ escaped.push(c);
+ }
self.errors.push(ParserError {
lo: pos,
hi: pos + 1,
@@ -393,7 +395,9 @@ impl<'a> Parser<'a> {
}
Some((pos, ch)) => {
let mut escaped = String::new();
- ch.escape_default(|c| escaped.push(c));
+ for c in ch.escape_default() {
+ escaped.push(c);
+ }
let next_pos = me.next_pos();
me.errors.push(ParserError {
lo: pos,
@@ -456,7 +460,7 @@ impl<'a> Parser<'a> {
let mut is_float = false;
loop {
match self.cur.clone().next() {
- Some((_, ch)) if ch.is_digit() => { self.cur.next(); }
+ Some((_, ch)) if ch.is_digit(10) => { self.cur.next(); }
Some((_, '.')) if !is_float => {
is_float = true;
self.cur.next();
@@ -527,25 +531,25 @@ impl<'a> Parser<'a> {
}
let mut it = date.as_slice().chars();
let mut valid = true;
- valid = valid && it.next().map(|c| c.is_digit()).unwrap_or(false);
- valid = valid && it.next().map(|c| c.is_digit()).unwrap_or(false);
- valid = valid && it.next().map(|c| c.is_digit()).unwrap_or(false);
- valid = valid && it.next().map(|c| c.is_digit()).unwrap_or(false);
+ valid = valid && it.next().map(|c| c.is_digit(10)).unwrap_or(false);
+ valid = valid && it.next().map(|c| c.is_digit(10)).unwrap_or(false);
+ valid = valid && it.next().map(|c| c.is_digit(10)).unwrap_or(false);
+ valid = valid && it.next().map(|c| c.is_digit(10)).unwrap_or(false);
valid = valid && it.next().map(|c| c == '-').unwrap_or(false);
- valid = valid && it.next().map(|c| c.is_digit()).unwrap_or(false);
- valid = valid && it.next().map(|c| c.is_digit()).unwrap_or(false);
+ valid = valid && it.next().map(|c| c.is_digit(10)).unwrap_or(false);
+ valid = valid && it.next().map(|c| c.is_digit(10)).unwrap_or(false);
valid = valid && it.next().map(|c| c == '-').unwrap_or(false);
- valid = valid && it.next().map(|c| c.is_digit()).unwrap_or(false);
- valid = valid && it.next().map(|c| c.is_digit()).unwrap_or(false);
+ valid = valid && it.next().map(|c| c.is_digit(10)).unwrap_or(false);
+ valid = valid && it.next().map(|c| c.is_digit(10)).unwrap_or(false);
valid = valid && it.next().map(|c| c == 'T').unwrap_or(false);
- valid = valid && it.next().map(|c| c.is_digit()).unwrap_or(false);
- valid = valid && it.next().map(|c| c.is_digit()).unwrap_or(false);
+ valid = valid && it.next().map(|c| c.is_digit(10)).unwrap_or(false);
+ valid = valid && it.next().map(|c| c.is_digit(10)).unwrap_or(false);
valid = valid && it.next().map(|c| c == ':').unwrap_or(false);
- valid = valid && it.next().map(|c| c.is_digit()).unwrap_or(false);
- valid = valid && it.next().map(|c| c.is_digit()).unwrap_or(false);
+ valid = valid && it.next().map(|c| c.is_digit(10)).unwrap_or(false);
+ valid = valid && it.next().map(|c| c.is_digit(10)).unwrap_or(false);
valid = valid && it.next().map(|c| c == ':').unwrap_or(false);
- valid = valid && it.next().map(|c| c.is_digit()).unwrap_or(false);
- valid = valid && it.next().map(|c| c.is_digit()).unwrap_or(false);
+ valid = valid && it.next().map(|c| c.is_digit(10)).unwrap_or(false);
+ valid = valid && it.next().map(|c| c.is_digit(10)).unwrap_or(false);
valid = valid && it.next().map(|c| c == 'Z').unwrap_or(false);
if valid {
Some(Datetime(date.clone()))
diff --git a/src/test/valid.rs b/src/test/valid.rs
index b60277e..09f1622 100644
--- a/src/test/valid.rs
+++ b/src/test/valid.rs
@@ -34,7 +34,7 @@ fn to_json(toml: Value) -> json::Json {
Some(&Table(..)) => true,
_ => false,
};
- let json = json::List(arr.into_iter().map(to_json).collect());
+ let json = json::Array(arr.into_iter().map(to_json).collect());
if is_table {json} else {doit("array", json)}
}
Table(table) => json::Object(table.into_iter().map(|(k, v)| {