From 2dc1913e0220a4113bd6a9eb165c55cda0bee590 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Wed, 21 Nov 2018 09:35:50 -0800 Subject: Fix trailing space after date. The space between date and time was being eagerly skipped when it shouldn't. --- src/de.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/de.rs b/src/de.rs index 491ae47..b5633ea 100644 --- a/src/de.rs +++ b/src/de.rs @@ -1035,13 +1035,12 @@ impl<'a> Deserializer<'a> { let start = self.tokens.substr_offset(date); // Check for space separated date and time. - if let Some((_, Token::Whitespace(s))) = self.peek()? { - if s == " " { - self.next()?; - // Skip past the hour. - if let Some((_, Token::Keylike(_))) = self.peek()? { - self.next()?; - } + let mut lookahead = self.tokens.clone(); + if let Ok(Some((_, Token::Whitespace(" ")))) = lookahead.next() { + // Check if hour follows. + if let Ok(Some((_, Token::Keylike(_)))) = lookahead.next() { + self.next()?; // skip space + self.next()?; // skip keylike hour } } -- cgit v1.2.3