1
0
mirror of https://github.com/bspeice/dtparse synced 2024-12-22 04:18:09 -05:00

Use ends_with in some places

This commit is contained in:
Mike Meehan 2018-07-18 20:34:14 -04:00
parent fe0a0ea3a7
commit fecba852d1

View File

@ -123,7 +123,7 @@ impl Iterator for Tokenizer {
if nextchar == '.' || self.isword(nextchar) { if nextchar == '.' || self.isword(nextchar) {
// UNWRAP: Because we're in non-empty parse state, we're guaranteed to have a token // UNWRAP: Because we're in non-empty parse state, we're guaranteed to have a token
token.as_mut().unwrap().push(nextchar); token.as_mut().unwrap().push(nextchar);
} else if self.isnum(nextchar) && token.as_ref().unwrap().chars().last() == Some('.') { } else if self.isnum(nextchar) && token.as_ref().unwrap().ends_with('.') {
token.as_mut().unwrap().push(nextchar); token.as_mut().unwrap().push(nextchar);
state = ParseState::NumericDecimal; state = ParseState::NumericDecimal;
} else { } else {
@ -135,7 +135,7 @@ impl Iterator for Tokenizer {
if nextchar == '.' || self.isnum(nextchar) { if nextchar == '.' || self.isnum(nextchar) {
// UNWRAP: Because we're in non-empty parse state, we're guaranteed to have a token // UNWRAP: Because we're in non-empty parse state, we're guaranteed to have a token
token.as_mut().unwrap().push(nextchar); token.as_mut().unwrap().push(nextchar);
} else if self.isword(nextchar) && token.as_ref().unwrap().chars().last() == Some('.') { } else if self.isword(nextchar) && token.as_ref().unwrap().ends_with('.') {
token.as_mut().unwrap().push(nextchar); token.as_mut().unwrap().push(nextchar);
state = ParseState::AlphaDecimal; state = ParseState::AlphaDecimal;
} else { } else {