1
Fork 0

Silence redundant error on char literal that was meant to be a string in 2021 edition

This commit is contained in:
Esteban Küber 2024-03-14 00:40:25 +00:00
parent 6f388ef1fb
commit ea1883d7b2
4 changed files with 20 additions and 15 deletions

View file

@ -59,6 +59,15 @@ impl<'a> Cursor<'a> {
iter.next().unwrap_or(EOF_CHAR)
}
/// Peeks the third symbol from the input stream without consuming it.
pub fn third(&self) -> char {
// `.next()` optimizes better than `.nth(1)`
let mut iter = self.chars.clone();
iter.next();
iter.next();
iter.next().unwrap_or(EOF_CHAR)
}
/// Checks if there is nothing more to consume.
pub(crate) fn is_eof(&self) -> bool {
self.chars.as_str().is_empty()