Use last instead of next_back
This commit is contained in:
parent
39a561f2bb
commit
6ebe621834
|
|
@ -109,10 +109,7 @@ impl<'s> Scanner<'s> {
|
||||||
/// The previous index in the source string.
|
/// The previous index in the source string.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn last_index(&self) -> usize {
|
pub fn last_index(&self) -> usize {
|
||||||
self.eaten()
|
self.eaten().chars().last().map_or(0, |c| self.index - c.len_utf8())
|
||||||
.chars()
|
|
||||||
.next_back()
|
|
||||||
.map_or(0, |c| self.index - c.len_utf8())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The current index in the source string.
|
/// The current index in the source string.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue