mirror of
https://github.com/typst/typst
synced 2025-05-14 04:56:26 +08:00
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…
x
Reference in New Issue
Block a user