From fecba852d12761541e15626bcaa494515d3a46f5 Mon Sep 17 00:00:00 2001 From: Mike Meehan Date: Wed, 18 Jul 2018 20:34:14 -0400 Subject: [PATCH] Use ends_with in some places --- src/tokenize.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tokenize.rs b/src/tokenize.rs index bb982a0..81cc512 100644 --- a/src/tokenize.rs +++ b/src/tokenize.rs @@ -123,7 +123,7 @@ impl Iterator for Tokenizer { if nextchar == '.' || self.isword(nextchar) { // UNWRAP: Because we're in non-empty parse state, we're guaranteed to have a token 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); state = ParseState::NumericDecimal; } else { @@ -135,7 +135,7 @@ impl Iterator for Tokenizer { if nextchar == '.' || self.isnum(nextchar) { // UNWRAP: Because we're in non-empty parse state, we're guaranteed to have a token 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); state = ParseState::AlphaDecimal; } else {