diff options
author | Eric Huss <eric@huss.org> | 2018-11-21 09:35:50 -0800 |
---|---|---|
committer | Eric Huss <eric@huss.org> | 2018-11-21 09:35:50 -0800 |
commit | 2dc1913e0220a4113bd6a9eb165c55cda0bee590 (patch) | |
tree | 5a465664c0253556609b6bf285f1807d01e20469 /src | |
parent | f610ef33f4c12e363945ad3c80a1129b0389a699 (diff) | |
download | milf-rs-2dc1913e0220a4113bd6a9eb165c55cda0bee590.tar.gz milf-rs-2dc1913e0220a4113bd6a9eb165c55cda0bee590.zip |
Fix trailing space after date.
The space between date and time was being eagerly skipped when it shouldn't.
Diffstat (limited to 'src')
-rw-r--r-- | src/de.rs | 13 |
1 files changed, 6 insertions, 7 deletions
@@ -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 } } |