aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2018-11-21 11:55:03 -0600
committerGitHub <noreply@github.com>2018-11-21 11:55:03 -0600
commit9bb068c4f4cdb67f3814ca8d2e2768fe1789c284 (patch)
tree5a465664c0253556609b6bf285f1807d01e20469 /src
parentf610ef33f4c12e363945ad3c80a1129b0389a699 (diff)
parent2dc1913e0220a4113bd6a9eb165c55cda0bee590 (diff)
downloadmilf-rs-9bb068c4f4cdb67f3814ca8d2e2768fe1789c284.tar.gz
milf-rs-9bb068c4f4cdb67f3814ca8d2e2768fe1789c284.zip
Merge pull request #275 from ehuss/fix-datetime-trailing-space
Fix trailing space after date.
Diffstat (limited to 'src')
-rw-r--r--src/de.rs13
1 files changed, 6 insertions, 7 deletions
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
}
}